Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite resource error "encountered composed resource without required "crossplane.io/composition-resource-name" when not specifying any metadata.name in a resource #199

Open
spastorclovr opened this issue Nov 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@spastorclovr
Copy link

What happened?

In a composition, I am creating a Helm Release using the Helm provider.
There is only one resource that needs to be created (the Release object) so I am not specifying any metadata.name to let the function generate a unique name.

This is the output of crossplane beta trace 👇

NAME                                    SYNCED   READY   STATUS
WebserviceClaim/contour-app (default)   True     False   Waiting: Claim is waiting for composite resource to become Ready
└─ Webservice/contour-app-h4sf5         False    False   ReconcileError: ...ut required "crossplane.io/composition-resource-name" annotation
   └─ Release/contour-app-h4sf5-d9m2b   True     True    Available

and the error

cannot compose resources: cannot get existing composed resources: encountered composed resource without required "crossplane.io/composition-resource-name" annotation

-> The Managed resource is being created
-> The Composite resource is complaining about the "crossplane.io/composition-resource-name being missing.

Indeed looking at the Labels of the composed resource
👇

 Labels:       
              crossplane.io/claim-name=contour-app
              crossplane.io/claim-namespace=default
              crossplane.io/composite=contour-app-9wrft
Annotations:  
               crossplane.io/external-create-pending: 2024-11-22T11:20:03Z
              crossplane.io/external-create-succeeded: 2024-11-22T11:20:05Z
              crossplane.io/external-name: contour-app-9wrft-d9tj5
API Version:  helm.crossplane.io/v1beta1

When specifying a name this is the labels/annotations I get for one managed resource

Labels:  
              crossplane.io/claim-name=contour-app
              crossplane.io/claim-namespace=default
              crossplane.io/composite=contour-app-hb94c
Annotations:  
              crossplane.io/composition-resource-name: release2
              crossplane.io/external-create-pending: 2024-11-22T11:33:11Z
              crossplane.io/external-create-succeeded: 2024-11-22T11:33:13Z
              crossplane.io/external-name: release2

But then, when setting up a name for the resources I realize this would conflict with new resources created by the same claim.
I may be missing something here. It feels like there is always a need to specify a name for each resources and thus take care of its uniqueness?

Thanks!

What environment did it happen in?

Function version: 0.10.10

@spastorclovr spastorclovr added the bug Something isn't working label Nov 22, 2024
@Peefy
Copy link
Collaborator

Peefy commented Nov 22, 2024

Yes. Generally, we always need to set unique names for resources through the annotation

metadata.annotations: {
    "krm.kcl.dev/composition-resource-name" = "some-resource-name"
}

@spastorclovr
Copy link
Author

Thanks for the clarification.

When not setting up any name though, since there is some unique name auto-generated (not sure what is doing that), one would have expected the crossplane.io/composition-resource-name being setup also.
Isn't there a bug here?

@Peefy
Copy link
Collaborator

Peefy commented Nov 27, 2024

cc @zong-zhe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants