Skip to content

Commit 4a88428

Browse files
committed
pkg/cvo/sync_worker: TaskNodeComplete events during updates
Only during updates, because: * Install-time is a free-for-all, where the CVO doesn't block on anything. This would be a lot of "node complete" noise about nodes where we had only attempted to push manifests, and that's unlikely to be what event-readers expect TaskNodeComplete to imply. * Reconcile-time hopefully has very few instances where the CVO needs to stomp on changes, block on a recently Available=False operator, etc. Eventing on each completed TaskNode would be lots of noise without much interesting signal. During updates, we have the structured graph and blocking TaskNodes described in docs/user/reconciliation.md, and the flow through that graph is what the events from this commit will help shed light on. You could also achieve this by preserving logs from the CVO pods as they are repositioned throughout an update, but we don't have tooling in CI to do that conveniently today. The hardcoded name and namespace for cvoObjectRef isn't great (for example, it won't work in pkg/start/start_integration_test.go , where the ClusterVersion's name and namespace are random). But it's the pattern we've used since we started eventing in 475e71f (emit events for each new payload, 2020-07-21, openshift#411), so I'm recylcing it for now.
1 parent 71aef74 commit 4a88428

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cvo/sync_worker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,10 @@ func (w *SyncWorker) apply(ctx context.Context, payloadUpdate *payload.Update, w
704704
cr.Inc()
705705
klog.V(4).Infof("Done syncing for %s", task)
706706
}
707+
if work.State == payload.UpdatingPayload && len(tasks) > 0 {
708+
cvoObjectRef := &corev1.ObjectReference{APIVersion: "config.openshift.io/v1", Kind: "ClusterVersion", Name: "version", Namespace: "openshift-cluster-version"}
709+
w.eventRecorder.Eventf(cvoObjectRef, corev1.EventTypeNormal, "TaskNodeComplete", "synchronized task node ending in %s on update to version=%q image=%q", tasks[len(tasks)-1], work.Desired.Version, work.Desired.Image)
710+
}
707711
return nil
708712
})
709713
if len(errs) > 0 {

0 commit comments

Comments
 (0)