Skip to content

Claims fail to diff when composition labels have generated suffix #26

@jcogilvie

Description

@jcogilvie

What happened?

A resource derived from a Claim with name: foo in namespace default will have the following labels:

crossplane.io/composite: foo-12345
crossplane.io/claim-name: foo
crossplane.io/namespace: default

Currently when diffing a Claim we detect downstream resources as removed/re-added:

--- Role/example-lambda-function-82crv-role
- apiVersion: iam.aws.upbound.io/v1beta1
- kind: Role
- metadata:
-   annotations:
-     crossplane.io/composition-resource-name: role
-     crossplane.io/external-name: example-lambda-function-role
-   finalizers:
-   - finalizer.managedresource.crossplane.io
-   generateName: example-lambda-function-82crv-
-   labels:
-     crossplane.io/claim-name: example-lambda-function
-     crossplane.io/claim-namespace: default
-     crossplane.io/composite: example-lambda-function-82crv
-   name: example-lambda-function-82crv-role
- spec:
...

---
+++ Role/example-lambda-function-role
+ apiVersion: iam.aws.upbound.io/v1beta1
+ kind: Role
+ metadata:
+   annotations:
+     crossplane.io/composition-resource-name: role
+     crossplane.io/external-name: example-lambda-function-role
+   labels:
+     crossplane.io/composite: example-lambda-function
+   name: example-lambda-function-role
+ spec:
...

Instead, it should correctly detect that these are the same resource using the composite and claim labels, and detect a change.

How can we reproduce it?

Diff a composition with generated downstream resource names.

What environment did it happen in?

Crossplane version: v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions