Skip to content

Commit

Permalink
operator: use clusteroperator object to set available version
Browse files Browse the repository at this point in the history
The clusteroperator version object is updated to the new version
when Progressing=False. However, syncAvailableStatus is using the
incoming version in its status before syncProgressing officially
updates the clusteroperator object. This yields available at the incoming
version before we are finished.
  • Loading branch information
kikisdeliveryservice committed Aug 20, 2021
1 parent 4ca373b commit 28c305d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ func (optr *Operator) syncAvailableStatus() error {
return nil
}

optrVersion, _ := optr.vStore.Get("operator")
degraded := cov1helpers.IsStatusConditionTrue(co.Status.Conditions, configv1.OperatorDegraded)
message := fmt.Sprintf("Cluster has deployed %s", optrVersion)
message := fmt.Sprintf("Cluster has deployed %s", co.Status.Versions)

available := configv1.ConditionTrue

if degraded {
available = configv1.ConditionFalse
message = fmt.Sprintf("Cluster not available for %s", optrVersion)
mcoObjectRef := &corev1.ObjectReference{
Kind: co.Kind,
Name: co.Name,
Expand All @@ -117,6 +115,7 @@ func (optr *Operator) syncAvailableStatus() error {
}

optr.eventRecorder.Eventf(mcoObjectRef, corev1.EventTypeWarning, "OperatorNotAvailable", message)
message = fmt.Sprintf("Cluster not available for %s", co.Status.Versions)
}

coStatus := configv1.ClusterOperatorStatusCondition{
Expand Down

0 comments on commit 28c305d

Please sign in to comment.