Skip to content

No-op claim -> composed applies are not skipped #4970

@negz

Description

@negz

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 DeepCopyObject on the supplied XR.
  • The XR is a *composite.Unstructured
  • The *composite.Unstructured type doesn't have a DeepCopyObject method.
  • ...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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions