kubernetes-sigs / kubebuilder-declarative-pattern

A toolkit for building declarative operators with kubebuilder
Apache License 2.0
251 stars 84 forks source link

Close the WatchStart before starting the watch. It was anyways closed… #376

Closed barney-s closed 3 months ago

barney-s commented 5 months ago

Setting up Watch() sometimes results in Watch() being a blocking call. Add a cancellable context that times out sooner when there is no activity in the Apply() path. Otherwise it timesout in 5mins. Cancellable context is better than watch options.Timeout since watch timeout happens even if there is activity on the watch channel.

What this PR does / why we need it: In BeforeApply watch setup case, it blocks the Apply loop if the API server doesnt have any watch events for the first object being applied.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Additional documentation:

atoato88 commented 5 months ago

/assign @justinsb

atoato88 commented 5 months ago

Current title of this PR doesn't indicate the current contents, I think. Could you update the PR title?

k8s-ci-robot commented 3 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: barney-s

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment