kubernetes-sigs / kubebuilder-declarative-pattern

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

testreconciler: pause after reconciliation #322

Closed justinsb closed 1 year ago

justinsb commented 1 year ago

We sleep briefly (100ms) after updating the status.

This is a hack to ensure that we see the watch event, because otherwise we can start a re-reconcile based on our derived objects, and then reconcile again based on our own status update.

This is racy behaviour and causes non-determinism which breaks our golden tests.

We do this only in this test controller, but maybe we should have similar logic to "debounce" in all controllers.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Additional documentation:

justinsb commented 1 year ago

/test pull-declarative-test

We're getting closer, but sometimes kubectl seems to skip one or more discovery requests...

yuwenma commented 1 year ago

/lgtm

k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, yuwenma

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/OWNERS)~~ [justinsb] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment