feat: filter ignored-field differences from generated resource delta#714
Open
sapphirew wants to merge 1 commit into
Open
feat: filter ignored-field differences from generated resource delta#714sapphirew wants to merge 1 commit into
sapphirew wants to merge 1 commit into
Conversation
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
Contributor
Author
|
Companion runtime PR (must merge + release first): aws-controllers-k8s/runtime#256 — it adds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
DO NOT MERGE until the companion aws-controllers-k8s/runtime PR (ignore-fields selective reconciliation) is merged and released.
Regenerated
delta.goimportsackrt.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 generatednewResourceDelta(template:templates/pkg/resource/delta.go.tpl), inserted after thedelta_post_comparehook block and immediately beforereturn delta. It also adds the two required imports:github.com/aws-controllers-k8s/runtime/pkg/featuregateand the runtime package aliasackrt "github.com/aws-controllers-k8s/runtime/pkg/runtime".Why
The runtime-only change made
updateResourcehonor theservices.k8s.aws/ignore-fieldsannotation, but it could not close the IsSynced / requeue gap: every other consumer of the computed delta (most importantly the requeue /IsSyncedpath) 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
SelectiveReconciliationfeature gate is disabled, so controllers that do not opt in are completely unaffected.delta.go. Controllers pick it up only on their next code-gen + runtime bump.Refs #2367