feat: filter ignore-field-drift differences from generated resource delta#714
feat: filter ignore-field-drift differences from generated resource delta#714sapphirew wants to merge 1 commit into
Conversation
|
Companion runtime PR (must merge + release first): aws-controllers-k8s/runtime#256 — it adds |
|
/hold |
…delta 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-field-drift annotation, differences under an ignored field path are removed from the computed delta. This ensures every consumer of the generated delta -- including the requeue / IsSynced path -- treats those fields' drift as ignored, 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. Refs aws-controllers-k8s/community#2367
d5937d5 to
0204373
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sapphirew The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Updated to |
|
@sapphirew: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Wires the runtime's selective field reconciliation feature into the generated per-resource delta. After the existing
delta_post_comparehook (and beforereturn delta), the generatednewResourceDeltanow callsackrt.FilterIgnoredDeltaDifferences(delta, a, featuregate.GetGlobalFeatureGates()).This ensures that when the
SelectiveReconciliationfeature gate is enabled and a resource carries theservices.k8s.aws/ignore-field-driftannotation, differences under an ignored field path are removed from the computed delta. As a result, every consumer of the generated delta — including the requeue /IsSyncedpath, not just the update path — treats drift on those fields as ignored, consistent with the runtime behavior.The call is gated and a no-op when the feature is disabled, so existing controllers are unaffected until an operator opts in. The only change is one template (
templates/pkg/resource/delta.go.tpl); controllers pick it up on their next code-generation + runtime bump. There are no CRD changes.Dependency / ordering
Testing
Regenerated the iam-controller with this template against the companion runtime: the generated
pkg/resource/role/delta.gocontains theFilterIgnoredDeltaDifferencescall and the controller compiles. The feature was then verified end-to-end on a live account (external tag survives reconciliation; resource staysSynced).Refs aws-controllers-k8s/community#2367