Skip to content

Commit

Permalink
pkg/cvo/sync_worker: Grow logging in SyncWorker.Update
Browse files Browse the repository at this point in the history
To make it easier to debug situations where the CVO's Operator.sync logs

  Desired version from spec is ...

but the sync worker itself doesn't seem to pick up the update [1,2].

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1843505#c19
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1873900
  • Loading branch information
wking committed Sep 10, 2020
1 parent d6475ef commit 48b59d1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,13 @@ func (w *SyncWorker) Update(generation int64, desired configv1.Update, overrides
w.work.Generation = generation
}

if work.Empty() || equalSyncWork(w.work, work) {
if work.Empty() {
klog.V(5).Info("Update work has no release image; ignoring requested change")
return w.status.DeepCopy()
}

if equalSyncWork(w.work, work) {
klog.V(5).Info("Update work is equal to current target; no change required")
return w.status.DeepCopy()
}

Expand All @@ -234,12 +240,15 @@ func (w *SyncWorker) Update(generation int64, desired configv1.Update, overrides
// notify the sync loop that we changed config
w.work = work
if w.cancelFn != nil {
klog.V(5).Info("Cancel the sync worker's current loop")
w.cancelFn()
w.cancelFn = nil
}
select {
case w.notify <- struct{}{}:
klog.V(5).Info("Notify the sync worker that new work is available")
default:
klog.V(5).Info("The sync worker has already been notified that new work is available")
}

return w.status.DeepCopy()
Expand Down

0 comments on commit 48b59d1

Please sign in to comment.