Repository navigation
fix: include apiVersion in the phase-1 resource matching identity key - #506
Closed
carlochessamp wants to merge 1 commit into
Closed
carlochessamp wants to merge 1 commit into
carlochessamp wants to merge 1 commit into
Conversation
Resources from different CRD groups can share kind+name (e.g. an Istio networking.istio.io/v1alpha3 VirtualService and a Gloo gateway.solo.io/v1 VirtualService named after the same app). With kind+name-only keys they collapsed into one key and phase 1 paired them by index order within the key's slice - i.e. by manifest extraction order, which differs independently between the base and target extractions under --render-method server-api. When the orders disagreed, identical renders cross-paired and reported both resources as changed, producing large mirrored phantom hunks per app. Fixes dag-andersen#505
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.
Fix
What
Include
apiVersionin the phase-1 resource identity key so resources from different CRD groups that share kind + name (e.g. an Istionetworking.istio.io/v1alpha3VirtualService and a Gloogateway.solo.io/v1VirtualService, both named after the app) are treated as distinct identities when pairing base and target manifests.Why
Fixes #505. With kind+name-only keys, such duplicate-named resources collapse to one key and phase 1 pairs them by index order within the key's index slice — i.e. by manifest extraction order, which under
--render-method server-apidiffers independently between the base and target extractions. When the orders disagree, istio↔gloo cross-pairs both ways,resourcesEqualreports both pairs as changed, and byte-identical renders emit large mirrored phantom hunks per app. We observed this at fleet scale: 84 apps rendering both VirtualServices, ~half of them flagged asModifiedwith ±100-line churn on any given run of a completely inert PR.After this change the two resources key separately (per apiVersion), each pairing with its identical counterpart → no diff, as expected. Genuine renames/kind-changes are unaffected: they never matched in phase 1 anyway and continue to be handled by the similarity phases (2–4).
Test
TestChangedResources_SameNameDifferentApiVersionSwappedOrder— base and target render identical istio+gloo VirtualServices in swapped order (extraction order is not guaranteed). Fails onmain(2 phantom changed pairs, cross-paired by index), passes with this fix (0 changed resources).Verified locally: