@@ -114,6 +114,15 @@ func MonitorClusterStatus(name string, syncCh chan error, stopCh <-chan struct{}
114
114
115
115
// update the status with the appropriate state
116
116
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" )
117
126
switch {
118
127
case successfulSyncs > 0 :
119
128
setOperatorStatusCondition (& existing .Status .Conditions , configv1.ClusterOperatorStatusCondition {
@@ -131,17 +140,24 @@ func MonitorClusterStatus(name string, syncCh chan error, stopCh <-chan struct{}
131
140
})
132
141
// we set the versions array when all the latest code is deployed and running - in this case,
133
142
// 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 {
135
144
existing .Status .Versions = []configv1.OperandVersion {
136
145
{
137
146
Name : "operator" ,
138
- Version : version ,
147
+ Version : targetOperatorVersion ,
139
148
},
140
149
{
141
150
Name : "operator-lifecycle-manager" ,
142
151
Version : olmversion .OLMVersion ,
143
152
},
144
153
}
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
+ }
145
161
} else {
146
162
existing .Status .Versions = nil
147
163
}
0 commit comments