Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,13 @@ func (c *Cluster) removeFailuresAnnotation() error {
106
106
return nil
107
107
}
108
108
109
- func (c * Cluster ) criticalOperationLabel (pods []v1.Pod , active bool ) error {
109
+ func (c * Cluster ) criticalOperationLabel (pods []v1.Pod , value string ) error {
110
110
var action string
111
111
var metadataReq map [string ]map [string ]map [string ]* string
112
112
113
- if active {
113
+ if value != "" {
114
114
action = "assign"
115
- val := "true"
116
- metadataReq = map [string ]map [string ]map [string ]* string {"metadata" : {"labels" : {"critical-operation" : & val }}}
115
+ metadataReq = map [string ]map [string ]map [string ]* string {"metadata" : {"labels" : {"critical-operation" : & value }}}
117
116
} else {
118
117
action = "remove"
119
118
metadataReq = map [string ]map [string ]map [string ]* string {"metadata" : {"labels" : {"critical-operation" : nil }}}
@@ -252,12 +251,12 @@ func (c *Cluster) majorVersionUpgrade() error {
252
251
c .logger .Infof ("healthy cluster ready to upgrade, current: %d desired: %d" , c .currentMajorVersion , desiredVersion )
253
252
if c .currentMajorVersion < desiredVersion {
254
253
defer func () error {
255
- if err = c .criticalOperationLabel (pods , false ); err != nil {
254
+ if err = c .criticalOperationLabel (pods , "" ); err != nil {
256
255
return fmt .Errorf ("failed to remove critical-operation label: %s" , err )
257
256
}
258
257
return nil
259
258
}()
260
- if err = c .criticalOperationLabel (pods , true ); err != nil {
259
+ if err = c .criticalOperationLabel (pods , " true" ); err != nil {
261
260
return fmt .Errorf ("failed to assign critical-operation label: %s" , err )
262
261
}
263
262
0 commit comments