Skip to content

Commit

Permalink
Merge pull request #292 from openshift-cherrypick-robot/cherry-pick-2…
Browse files Browse the repository at this point in the history
…85-to-release-4.14

[release-4.14] OCPBUGS-20038: Ensure status reporter caches exit if they don't sync
  • Loading branch information
openshift-ci[bot] committed Oct 8, 2023
2 parents 6e599bd + 77df4e5 commit 63b23fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/operator/status.go
Expand Up @@ -338,12 +338,18 @@ func (c *StatusReporter) runWorker(queueCtx context.Context) {
func (r *StatusReporter) Start(stop context.Context) error {
// run informer to make sure that we report status everytime the cluster operator changes
// for example. if some external process override message or reason.
klog.Info("Starting status reporter: cluster operator informers")
go r.configInformers.Start(stop.Done())

cacheWaitCtx, cacheWaitCancel := context.WithTimeout(stop, 30*time.Second)
defer cacheWaitCancel()

operatorInformer := r.configInformers.Config().V1().ClusterOperators().Informer()
if !cache.WaitForCacheSync(stop.Done(), operatorInformer.HasSynced) {
if !cache.WaitForCacheSync(cacheWaitCtx.Done(), operatorInformer.HasSynced) {
return fmt.Errorf("unable to sync clusteroperators informer")
}

klog.Info("Starting status reporter: worker")
go r.runWorker(stop)

operatorInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
Expand Down

0 comments on commit 63b23fc

Please sign in to comment.