-
Notifications
You must be signed in to change notification settings - Fork 1.2k
No-op claim -> composed applies are not skipped #4970
Copy link
Copy link
Closed
crossplane/crossplane-runtime
#599Closed
Copy link
Labels
Description
What happened?
While investigating #4968 I noticed that the logic added in 4a0bb29 doesn't work. If you replace the cmp.Equal with a cmp.Diff and print it, you'll see a lot of this:
any(
- &composite.Unstructured{...},
+ &unstructured.Unstructured{...},
)
The root cause is that:
- The patching applicator calls
DeepCopyObjecton the supplied XR. - The XR is a
*composite.Unstructured - The
*composite.Unstructuredtype doesn't have aDeepCopyObjectmethod. - ...but it does embed
*kunstructured.Unstructured, which does.
That is, the cmp.Equal ends up comparing a *composite.Unstructured with a *kunstructured.Unstructured. They wrap the same map[string]any but are different types, and thus will never be equal.
How can we reproduce it?
| err := r.client.Apply(ctx, cp, resource.AllowUpdateIf(func(old, obj runtime.Object) bool { return !cmp.Equal(old, obj) })) |
Switch the cmp.Equal to a cmp.Diff and print the diff.
What environment did it happen in?
Crossplane version: v1.14.0
Reactions are currently unavailable