Skip to content

Commit 2b45354

Browse files
Merge pull request #500 from jottofar/bug-1905221-fix
Bug 1905221: pkg/cvo/sync_worker.go: Ignore work changes during init
2 parents e5b4906 + 213726d commit 2b45354

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

pkg/cvo/sync_worker.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (w *SyncWorker) Update(generation int64, desired configv1.Update, overrides
222222
return w.status.DeepCopy()
223223
}
224224

225-
if equalSyncWork(w.work, work) {
225+
if equalSyncWork(w.work, work, state) {
226226
klog.V(5).Info("Update work is equal to current target; no change required")
227227
return w.status.DeepCopy()
228228
}
@@ -401,7 +401,7 @@ func (w *SyncWorker) calculateNext(work *SyncWork) bool {
401401
w.lock.Lock()
402402
defer w.lock.Unlock()
403403

404-
changed := !equalSyncWork(w.work, work)
404+
changed := !equalSyncWork(w.work, work, w.work.State)
405405

406406
// if this is the first time through the loop, initialize reconciling to
407407
// the state Update() calculated (to allow us to start in reconciling)
@@ -465,7 +465,7 @@ func splitDigest(pullspec string) string {
465465
}
466466

467467
// equalSyncWork returns true if a and b are equal.
468-
func equalSyncWork(a, b *SyncWork) bool {
468+
func equalSyncWork(a, b *SyncWork, state payload.State) bool {
469469
if a == b {
470470
return true
471471
}
@@ -475,14 +475,20 @@ func equalSyncWork(a, b *SyncWork) bool {
475475
sameVersion := equalUpdate(a.Desired, b.Desired)
476476
overridesEqual := reflect.DeepEqual(a.Overrides, b.Overrides)
477477

478+
var detected string
478479
if !sameVersion && !overridesEqual {
479-
klog.V(5).Info("Detected version and overrides changes")
480-
return false
480+
detected = "version and overrides changes"
481481
} else if !sameVersion {
482-
klog.V(5).Info("Detected version change")
483-
return false
482+
detected = "version change"
484483
} else if !overridesEqual {
485-
klog.V(5).Info("Detected overrides change")
484+
detected = "overrides change"
485+
}
486+
if detected != "" {
487+
if state == payload.InitializingPayload {
488+
klog.Warning("Ignoring detected %s during payload initialization", detected)
489+
return true
490+
}
491+
klog.V(5).Info("Detected %s", detected)
486492
return false
487493
}
488494
return true

0 commit comments

Comments
 (0)