@@ -43,7 +43,6 @@ import (
43
43
)
44
44
45
45
const (
46
- cephVersionLabelKey = "ceph_version"
47
46
DoNotReconcileLabelName = "do_not_reconcile"
48
47
)
49
48
@@ -87,11 +86,6 @@ func WatchControllerPredicate() predicate.Funcs {
87
86
} else if objOld .GetGeneration () != objNew .GetGeneration () {
88
87
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
89
88
}
90
- // Handling upgrades
91
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
92
- if isUpgrade {
93
- return true
94
- }
95
89
96
90
case * cephv1.CephObjectStoreUser :
97
91
objNew := e .ObjectNew .(* cephv1.CephObjectStoreUser )
@@ -212,11 +206,6 @@ func WatchControllerPredicate() predicate.Funcs {
212
206
} else if objOld .GetGeneration () != objNew .GetGeneration () {
213
207
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
214
208
}
215
- // Handling upgrades
216
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
217
- if isUpgrade {
218
- return true
219
- }
220
209
221
210
case * cephv1.CephNFS :
222
211
objNew := e .ObjectNew .(* cephv1.CephNFS )
@@ -237,11 +226,6 @@ func WatchControllerPredicate() predicate.Funcs {
237
226
} else if objOld .GetGeneration () != objNew .GetGeneration () {
238
227
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
239
228
}
240
- // Handling upgrades
241
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
242
- if isUpgrade {
243
- return true
244
- }
245
229
246
230
case * cephv1.CephRBDMirror :
247
231
objNew := e .ObjectNew .(* cephv1.CephRBDMirror )
@@ -262,11 +246,6 @@ func WatchControllerPredicate() predicate.Funcs {
262
246
} else if objOld .GetGeneration () != objNew .GetGeneration () {
263
247
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
264
248
}
265
- // Handling upgrades
266
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
267
- if isUpgrade {
268
- return true
269
- }
270
249
271
250
case * cephv1.CephClient :
272
251
objNew := e .ObjectNew .(* cephv1.CephClient )
@@ -287,11 +266,6 @@ func WatchControllerPredicate() predicate.Funcs {
287
266
} else if objOld .GetGeneration () != objNew .GetGeneration () {
288
267
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
289
268
}
290
- // Handling upgrades
291
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
292
- if isUpgrade {
293
- return true
294
- }
295
269
296
270
case * cephv1.CephFilesystemMirror :
297
271
objNew := e .ObjectNew .(* cephv1.CephFilesystemMirror )
@@ -312,11 +286,6 @@ func WatchControllerPredicate() predicate.Funcs {
312
286
} else if objOld .GetGeneration () != objNew .GetGeneration () {
313
287
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
314
288
}
315
- // Handling upgrades
316
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
317
- if isUpgrade {
318
- return true
319
- }
320
289
321
290
case * cephv1.CephBucketTopic :
322
291
objNew := e .ObjectNew .(* cephv1.CephBucketTopic )
@@ -337,11 +306,6 @@ func WatchControllerPredicate() predicate.Funcs {
337
306
} else if objOld .GetGeneration () != objNew .GetGeneration () {
338
307
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
339
308
}
340
- // Handling upgrades
341
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
342
- if isUpgrade {
343
- return true
344
- }
345
309
346
310
case * cephv1.CephBucketNotification :
347
311
objNew := e .ObjectNew .(* cephv1.CephBucketNotification )
@@ -362,11 +326,6 @@ func WatchControllerPredicate() predicate.Funcs {
362
326
} else if objOld .GetGeneration () != objNew .GetGeneration () {
363
327
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
364
328
}
365
- // Handling upgrades
366
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
367
- if isUpgrade {
368
- return true
369
- }
370
329
371
330
case * cephv1.CephFilesystemSubVolumeGroup :
372
331
objNew := e .ObjectNew .(* cephv1.CephFilesystemSubVolumeGroup )
@@ -387,11 +346,6 @@ func WatchControllerPredicate() predicate.Funcs {
387
346
} else if objOld .GetGeneration () != objNew .GetGeneration () {
388
347
logger .Debugf ("skipping resource %q update with unchanged spec" , objNew .Name )
389
348
}
390
- // Handling upgrades
391
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
392
- if isUpgrade {
393
- return true
394
- }
395
349
396
350
case * bktv1alpha1.ObjectBucketClaim :
397
351
objNew := e .ObjectNew .(* bktv1alpha1.ObjectBucketClaim )
@@ -431,11 +385,6 @@ func WatchControllerPredicate() predicate.Funcs {
431
385
} else if objOld .GetGeneration () != objNew .GetGeneration () {
432
386
logger .Debugf ("skipping CephBlockPoolRadosNamespace resource %q update with unchanged spec" , namespacedName )
433
387
}
434
- // Handling upgrades
435
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
436
- if isUpgrade {
437
- return true
438
- }
439
388
440
389
case * cephv1.CephCOSIDriver :
441
390
objNew := e .ObjectNew .(* cephv1.CephCOSIDriver )
@@ -458,11 +407,6 @@ func WatchControllerPredicate() predicate.Funcs {
458
407
} else if objOld .GetGeneration () != objNew .GetGeneration () {
459
408
logger .Debugf ("skipping CephCOSIDriver resource %q update with unchanged spec" , namespacedName )
460
409
}
461
- // Handling upgrades
462
- isUpgrade := isUpgrade (objOld .GetLabels (), objNew .GetLabels ())
463
- if isUpgrade {
464
- return true
465
- }
466
410
467
411
}
468
412
return false
@@ -679,28 +623,6 @@ func logErrorUnlessSensitive(msg string, err error, isSensitive bool) {
679
623
}
680
624
}
681
625
682
- func isUpgrade (oldLabels , newLabels map [string ]string ) bool {
683
- oldLabelVal , oldLabelKeyExist := oldLabels [cephVersionLabelKey ]
684
- newLabelVal , newLabelKeyExist := newLabels [cephVersionLabelKey ]
685
-
686
- // Nothing exists
687
- if ! oldLabelKeyExist && ! newLabelKeyExist {
688
- return false
689
- }
690
-
691
- // The new object has the label key so we reconcile
692
- if ! oldLabelKeyExist && newLabelKeyExist {
693
- return true
694
- }
695
-
696
- // Both objects have the label and values are different so we reconcile
697
- if (oldLabelKeyExist && newLabelKeyExist ) && oldLabelVal != newLabelVal {
698
- return true
699
- }
700
-
701
- return false
702
- }
703
-
704
626
func isCanary (obj runtime.Object ) bool {
705
627
// If not a deployment, let's not reconcile
706
628
d , ok := obj .(* appsv1.Deployment )
0 commit comments