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.
@@ -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{
