From 28c305d9550946702f145ba061d6cec8fcf9502f Mon Sep 17 00:00:00 2001 From: Kirsten Garrison Date: Wed, 18 Aug 2021 14:35:50 -0700 Subject: [PATCH] operator: use clusteroperator object to set available version 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. --- pkg/operator/status.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/operator/status.go b/pkg/operator/status.go index 8e8cdd185a..ac4f7d1af9 100644 --- a/pkg/operator/status.go +++ b/pkg/operator/status.go @@ -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, @@ -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{