Skip to content

Add spec.policyChangeDelay to batch image updates - #1112

Merged
stefanprodan merged 4 commits into
mainfrom
policy-change-delay
Oct 24, 2026
Merged

stefanprodan merged 4 commits into
mainfrom
policy-change-delay

Conversation

@stefanprodan

@stefanprodan stefanprodan commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Adds an optional .spec.policyChangeDelay to ImageUpdateAutomation. When set, an ImagePolicy change enqueues the automation after the delay instead of immediately, so image updates arriving within the delay go into one commit. The delay starts at the first change and is not extended by later ones. The interval, spec changes, GitRepository changes and manual reconcile requests are not delayed.

This new field respects .spec.policySelector. If both are set, only ImagePolicy changes for policies selected by .spec.policySelector trigger a run.

Example:

spec:
  interval: 30m
  policyChangeDelay: 2m

Without the delay, behaviour is unchanged: every automation in the namespace runs as soon as any policy triggers them.

Fixes #313
xref: fluxcd/flux2#2461

@stefanprodan stefanprodan added enhancement New feature or request area/api API related issues and pull requests labels Oct 24, 2026
@stefanprodan stefanprodan changed the title Add spec.policyChangeDelay to batch image updates Add spec.policyChangeDelay to batch image updates Oct 24, 2026
The field defers the run triggered by an ImagePolicy change so that
a burst of image updates is committed together.

Signed-off-by: Stefan Prodan <[email protected]>
The fake recorder blocks once its 32-event buffer is full because no
test drains it, which stalls the reconciler in later tests.

Signed-off-by: Stefan Prodan <[email protected]>
When spec.policyChangeDelay is set, ImagePolicy changes enqueue the
automation after the delay, so image updates arriving within it are
committed together. Only automations that select the policy (old or
new labels) or have observed it are enqueued. Without the delay, every
automation in the namespace is enqueued immediately, as before.

Signed-off-by: Stefan Prodan <[email protected]>
Signed-off-by: Stefan Prodan <[email protected]>

@matheuscscp matheuscscp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@stefanprodan
stefanprodan merged commit 0615a73 into main Oct 24, 2026
5 checks passed
@stefanprodan
stefanprodan deleted the policy-change-delay branch October 24, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why ImagePolicy immediately trigger IA to commit update?

2 participants