Skip to content

Commit ab2f672

Browse files
committed
chore(cvo): report progressing=true if the version has updated
1 parent ddefc0e commit ab2f672

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pkg/lib/operatorstatus/status.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ func MonitorClusterStatus(name string, syncCh chan error, stopCh <-chan struct{}
114114

115115
// update the status with the appropriate state
116116
previousStatus := existing.Status.DeepCopy()
117+
previousOperatorVersion := func(vs []configv1.OperandVersion) string {
118+
for _, v := range vs {
119+
if v.Name == "operator" {
120+
return v.Version
121+
}
122+
}
123+
return ""
124+
}(previousStatus.Versions)
125+
targetOperatorVersion := os.Getenv("RELEASE_VERSION")
117126
switch {
118127
case successfulSyncs > 0:
119128
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
@@ -131,17 +140,24 @@ func MonitorClusterStatus(name string, syncCh chan error, stopCh <-chan struct{}
131140
})
132141
// we set the versions array when all the latest code is deployed and running - in this case,
133142
// the sync method is responsible for guaranteeing that happens before it returns nil
134-
if version := os.Getenv("RELEASE_VERSION"); len(version) > 0 {
143+
if len(targetOperatorVersion) > 0 {
135144
existing.Status.Versions = []configv1.OperandVersion{
136145
{
137146
Name: "operator",
138-
Version: version,
147+
Version: targetOperatorVersion,
139148
},
140149
{
141150
Name: "operator-lifecycle-manager",
142151
Version: olmversion.OLMVersion,
143152
},
144153
}
154+
if targetOperatorVersion != previousOperatorVersion {
155+
setOperatorStatusCondition(&existing.Status.Conditions, configv1.ClusterOperatorStatusCondition{
156+
Type: configv1.OperatorProgressing,
157+
Status: configv1.ConditionTrue,
158+
Message: fmt.Sprintf("Deployed %s", olmversion.OLMVersion),
159+
})
160+
}
145161
} else {
146162
existing.Status.Versions = nil
147163
}

0 commit comments

Comments
 (0)