kubernetes-sigs / kubebuilder-declarative-pattern

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

Respect ErrorResults returned from preflight checks #386

Closed tomasaschan closed 4 weeks ago

tomasaschan commented 2 months ago

What this PR does / why we need it: A common pattern in our operators is to use preflight checks to call out to some external system for more information (that can be written e.g. to the status of the DeclarativeObject) or to validate that some property of the spec meets requirements to be able to expand the channel manifests. If the check fails, sometimes the right behavior is to requeue with backoff - but often it's not: e.g., if the spec is deemed invalid, there's no reason to requeue the resource. If spec changes we'll get a new event anyway, and until spec changes we won't be able to reconcile.

There is already a ErrorResult type that can be used in a Preflight implementation to signal what we want the reconciliation function to return, but it's currently not being respected. This change addresses that.

Which issue(s) this PR fixes:

Fixes #374

tomasaschan commented 2 months ago

/assign justinsb

tomasaschan commented 2 months ago

/assign atoato88

k8s-ci-robot commented 4 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

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

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,tomasaschan] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment