@@ -123,11 +123,11 @@ func (c *customPluginMonitor) Stop() {
123
123
// there is one customPluginMonitor, one plugin instance for each configPath.
124
124
// each runs rules in parallel at pre-configured concurrency, and interval.
125
125
func (c * customPluginMonitor ) monitorLoop () {
126
- if ! * c .config .PluginGlobalConfig .SkipInitialStatus {
127
- c .initializeStatus ()
126
+ c .initializeConditions ()
127
+ if * c .config .PluginGlobalConfig .SkipInitialStatus {
128
+ klog .Infof ("Skipping sending initial status. Using default conditions: %+v" , c .conditions )
128
129
} else {
129
- c .conditions = initialConditions (c .config .DefaultConditions )
130
- klog .Infof ("Skipping condition initialization: %+v" , c .conditions )
130
+ c .sendInitialStatus ()
131
131
}
132
132
133
133
resultChan := c .plugin .GetResultChan ()
@@ -296,18 +296,22 @@ func toConditionStatus(s cpmtypes.Status) types.ConditionStatus {
296
296
}
297
297
}
298
298
299
- // initializeStatus initializes the internal condition and also reports it to the node problem detector.
300
- func (c * customPluginMonitor ) initializeStatus () {
301
- // Initialize the default node conditions
302
- c .conditions = initialConditions (c .config .DefaultConditions )
303
- klog .Infof ("Initialize condition generated: %+v" , c .conditions )
299
+ // sendInitialStatus sends the initial status to the node problem detector.
300
+ func (c * customPluginMonitor ) sendInitialStatus () {
301
+ klog .Infof ("Sending initial status for %s with conditions: %+v" , c .config .Source , c .conditions )
304
302
// Update the initial status
305
303
c .statusChan <- & types.Status {
306
304
Source : c .config .Source ,
307
305
Conditions : c .conditions ,
308
306
}
309
307
}
310
308
309
+ // initializeConditions initializes the internal node conditions.
310
+ func (c * customPluginMonitor ) initializeConditions () {
311
+ c .conditions = initialConditions (c .config .DefaultConditions )
312
+ klog .Infof ("Initialized conditions for %s: %+v" , c .configPath , c .conditions )
313
+ }
314
+
311
315
func initialConditions (defaults []types.Condition ) []types.Condition {
312
316
conditions := make ([]types.Condition , len (defaults ))
313
317
copy (conditions , defaults )
0 commit comments