Skip to content

Commit

Permalink
Merge pull request openshift#3111 from harche/fix_condition_checking
Browse files Browse the repository at this point in the history
Do not check for status of other operators for node config
  • Loading branch information
openshift-merge-robot authored Apr 26, 2022
2 parents 35b075a + d2faa8d commit 2a1e3a6
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions pkg/controller/kubelet-config/kubelet_config_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,29 +266,19 @@ func (ctrl *Controller) deleteNodeConfig(obj interface{}) {
glog.V(4).Infof("Deleted node config %s and restored default config", nodeConfig.Name)
}

// isReadyforUpdate returns a boolean based on the condition statuses present in the node config CR.
// The node config resource is considered to be not-ready if any status condition
// of any operator type is "Progressing". Otherwise, the resource is ready for the update.
// isReadyforUpdate returns a boolean to indicate if the node config is ready for update.
// The node config is considered not-ready if any status condition of kubelet rollout is
// either still in progress or failed. Otherwise, the node config is ready for the update.
func isReadyforUpdate(nodeConfig *osev1.Node) bool {
var conditionTypes = []string{
osev1.KubeAPIServerProgressing,
osev1.KubeControllerManagerProgressing,
osev1.KubeletProgressing,
osev1.KubeAPIServerDegraded,
osev1.KubeControllerManagerDegraded,
osev1.KubeletDegraded,
}
// if the node config resource is empty, it is ready for the update
// to hold the new configuration update request.
if nodeConfig == nil {
return true
}
if len(nodeConfig.Status.WorkerLatencyProfileStatus.Conditions) > 0 {
for _, condition := range nodeConfig.Status.WorkerLatencyProfileStatus.Conditions {
for _, conditionType := range conditionTypes {
if conditionType == condition.Type {
return false
}
if condition.Type == osev1.KubeletProgressing || condition.Type == osev1.KubeletDegraded {
return false
}
}
}
Expand Down

0 comments on commit 2a1e3a6

Please sign in to comment.