Open nan-yu opened 2 months ago
When comparing list fields within two objects, a simple equality check isn't enough. We need to implement a semantic check on the individual list items to ensure accurate comparisons.
Code Reference: The current equality check can be found here: https://github.com/kubernetes-sigs/structured-merge-diff/blob/v4.4.1/typed/compare.go#L148
Example: The following two objects should be evaluated as identical, even though their list item order differs:
kind: Role metadata: name: test-role namespace: test-ns rules: - apiGroups: - batch/v1 resources: - jobs verbs: - '*' - apiGroups: - apps/v1 resources: - deployments verbs: - '*'
and
kind: Role metadata: name: test-role namespace: test-ns rules: - apiGroups: - apps/v1 resources: - deployments verbs: - '*' - apiGroups: - batch/v1 resources: - jobs verbs: - '*'
When comparing list fields within two objects, a simple equality check isn't enough. We need to implement a semantic check on the individual list items to ensure accurate comparisons.
Code Reference: The current equality check can be found here: https://github.com/kubernetes-sigs/structured-merge-diff/blob/v4.4.1/typed/compare.go#L148
Example: The following two objects should be evaluated as identical, even though their list item order differs:
and