feat: prevent no-op reconciles

There are edge cases where a reonciliation can be triggered on a
suspended Kustomization, mainly through changes in a source.
In these cases a "no-op" reconciliation occurs, which can be confusing
for the user. This returns early if the Kustomization ist suspended.

Signed-off-by: Norman Stetter <85173861+norman-zon@users.noreply.github.com>
This commit is contained in:
Norman Stetter 2025-03-17 14:34:28 +01:00
parent dc0e5853c0
commit 2d89eb6010
No known key found for this signature in database
1 changed files with 5 additions and 0 deletions

View File

@ -189,6 +189,11 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
// Record Prometheus metrics.
r.Metrics.RecordDuration(ctx, obj, reconcileStart)
// Do not proceed if the Kustomization is suspended
if obj.Spec.Suspend {
return
}
// Log and emit success event.
if conditions.IsReady(obj) {
msg := fmt.Sprintf("Reconciliation finished in %s, next run in %s",