Skip to content

Commit

Permalink
mco: set co status upgradeable to false while pools updating
Browse files Browse the repository at this point in the history
Sets machine-config clusteroperator Upgradeable: False when pools are updating (covering future upgrades),
does not block current upgrade from reporting finished on all completing.

When pools are both Updating and Degraded, we prioritize reporting Degraded:
If any pool is Degraded, the clusteroperator status.Reason == DegradedPool.
Otherwise, if any pool is Updating (but none are Degraded) status.Reason == PoolUpdating.
  • Loading branch information
kikisdeliveryservice committed Apr 8, 2021
1 parent 046a870 commit 42b0032
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,27 @@ func (optr *Operator) syncUpgradeableStatus() error {
Status: configv1.ConditionTrue,
Reason: asExpectedReason,
}
var updating, degraded bool
for _, pool := range pools {
degraded := isPoolStatusConditionTrue(pool, mcfgv1.MachineConfigPoolDegraded)
// collect updating status but continue to check each pool to see if any pool is degraded
if isPoolStatusConditionTrue(pool, mcfgv1.MachineConfigPoolUpdating) {
updating = true
}
degraded = isPoolStatusConditionTrue(pool, mcfgv1.MachineConfigPoolDegraded)
// degraded should get top billing in the clusteroperator status, if we find this, set it and update
if degraded {
coStatus.Status = configv1.ConditionFalse
coStatus.Reason = "DegradedPool"
coStatus.Message = "One or more machine config pool is degraded, please see `oc get mcp` for further details and resolve before upgrading"
coStatus.Message = "One or more machine config pools are degraded, please see `oc get mcp` for further details and resolve before upgrading"
break
}
}
// updating and degraded can occur together, in that case defer to the degraded Reason that is already set above
if updating && !degraded {
coStatus.Status = configv1.ConditionFalse
coStatus.Reason = "PoolUpdating"
coStatus.Message = "One or more machine config pools are updating, please see `oc get mcp` for further details"
}

return optr.updateStatus(co, coStatus)
}
Expand Down

0 comments on commit 42b0032

Please sign in to comment.