Skip to content

feat: filter ignored-field differences from generated resource delta#714

Open
sapphirew wants to merge 1 commit into
aws-controllers-k8s:mainfrom
sapphirew:ignore-fields-delta-filter
Open

feat: filter ignored-field differences from generated resource delta#714
sapphirew wants to merge 1 commit into
aws-controllers-k8s:mainfrom
sapphirew:ignore-fields-delta-filter

Conversation

@sapphirew

@sapphirew sapphirew commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Warning

DO NOT MERGE until the companion aws-controllers-k8s/runtime PR (ignore-fields selective reconciliation) is merged and released.

Regenerated delta.go imports ackrt.FilterIgnoredDeltaDifferences, which does not exist in the currently released runtime. Merging this before the runtime change is released and consumed will break code generation / compilation for controllers that regenerate against the released runtime.

Summary

This adds a single gated call to ackrt.FilterIgnoredDeltaDifferences(delta, a, featuregate.GetGlobalFeatureGates()) in the generated newResourceDelta (template: templates/pkg/resource/delta.go.tpl), inserted after the delta_post_compare hook block and immediately before return delta. It also adds the two required imports: github.com/aws-controllers-k8s/runtime/pkg/featuregate and the runtime package alias ackrt "github.com/aws-controllers-k8s/runtime/pkg/runtime".

Why

The runtime-only change made updateResource honor the services.k8s.aws/ignore-fields annotation, but it could not close the IsSynced / requeue gap: every other consumer of the computed delta (most importantly the requeue / IsSynced path) still saw ignored-field differences and kept marking the resource out-of-sync, causing perpetual requeues even though the controller would never act on those fields.

By filtering ignored-field differences out of the delta at the point it is produced, every consumer of the generated delta treats ignored fields as non-existent, matching the behavior already present in updateResource.

Safety / impact

  • The call is gated: it is a no-op when the SelectiveReconciliation feature gate is disabled, so controllers that do not opt in are completely unaffected.
  • The change is a one-line addition (plus imports) to every regenerated delta.go. Controllers pick it up only on their next code-gen + runtime bump.

Refs #2367

Adds a call to ackrt.FilterIgnoredDeltaDifferences in the generated
newResourceDelta so that, when the SelectiveReconciliation feature gate is
enabled and a resource carries the services.k8s.aws/ignore-fields
annotation, ignored-field differences are removed from the computed delta.
This ensures every consumer of the generated delta -- including the
requeue / IsSynced path -- treats ignored fields as non-existent, matching
the runtime behavior in updateResource.

The call is gated and a no-op when the feature is disabled, so existing
controllers are unaffected until they opt in.

Depends on the companion ack-runtime change that adds
FilterIgnoredDeltaDifferences and the process-wide feature-gate accessors.

Refs aws-controllers-k8s/community#2367
@sapphirew

Copy link
Copy Markdown
Contributor Author

Companion runtime PR (must merge + release first): aws-controllers-k8s/runtime#256 — it adds FilterIgnoredDeltaDifferences and the process-wide feature-gate accessors that this template change calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant