Skip to content

Allow not setting initial condition to avoid marking unhealthy nodes … #429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/custompluginmonitor/custom_plugin_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,20 @@ func toConditionStatus(s cpmtypes.Status) types.ConditionStatus {
func (c *customPluginMonitor) initializeStatus() {
// Initialize the default node conditions
c.conditions = initialConditions(c.config.DefaultConditions)
glog.Infof("Initialize condition generated: %+v", c.conditions)

// Initialize all conditions to their default state
initializedConditions := []types.Condition{}
for _, cond := range c.conditions {
if !cond.Uninitialized {
initializedConditions = append(initializedConditions, cond)
}
}
glog.Infof("Initialize condition generated: %+v", initializedConditions)

// Update the initial status
c.statusChan <- &types.Status{
Source: c.config.Source,
Conditions: c.conditions,
Conditions: initializedConditions,
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ type Condition struct {
Reason string `json:"reason"`
// Message is a human readable message of why node goes into this condition.
Message string `json:"message"`
// Set this to not automatically set initialStatus to False when NPD starts.
Uninitialized bool `json:"uninitialized"`
}

// Event is the event used internally by node problem detector.
Expand Down