-
Notifications
You must be signed in to change notification settings - Fork 81
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
In crossplane composition cannot patch spec.forProvider.manifest.metadata.namesapce #35
Comments
@uluzox for patches in composition, the source is the CompositeResource(XR) not the Claim(XRC), e.g. patches:
- fromFieldPath: "metadata.namespace"
toFieldPath: "spec.forProvider.manifest.metadata.namespace" This instructs to patch The problem here is that XRs are not namespace resources hence their |
The Composite Resource has labels with the claim name and claim namespace, so you can pull the information you want from those labels:
use the format:
|
Ok that works. Thank you so much! spec:
dataInject: injected part of the Claim can successfully be used for patching the XR with patches:
- fromFieldPath: "spec.dataInject"
toFieldPath: "spec.forProvider.manifest.data[injected]" ? Clearly the |
Your CompositeResourceDefinition defines two Custom Resource Definitions (CRDs), which you have called "CompositeSecret" and "MySecret". Those two CRDs contain the exact same set of input parameters, so when you create a Claim for a MySecret, you also get a CompositeSecret with the exact same inputs, which is where all of the Composition references take place. Your "FromCompositeFieldPath" patches retrieve information from the CompositeSecret instance for use in the Managed Resources (Object in this case), and your "ToCompositeFieldPath" patches will retrieve information from the Managed Resource and place it in the CompositeSecret instance. So yes, the spec.dataInhect comes from the MySecret instance, but it is copied into the CompositeSecret instance and that's the one the Composition is working with. Hopefully that makes sense? |
Motivation
I want to give a simple API for a complicated kubernetes resource manifest.
For better demonstration, the "complicated" k8s resource will be a
Secret
.What happened?
I created the following XRD and Composition
And claim it with
The idea is to created a k8s resource of kind
MySecret
with as little data as possible and by that create a more complex and importantly a different k8s resource.In this example I would like to see a
Secret
to be created that looks like this:What happens instead is that the
Secret
does not get created. Instead I see the following erroran empty namespace may not be set when a resource name is provided
.A
kubectl describe object secret-f7jbk-n52l5
returns:I also tried other resources instead of Secrets. Patching the namespace does not work. I am using
provider-kubernetes
for this because of Crossplane's Composite Resource Limitation for cluster scoped resources crossplane/crossplane#1730What environment did it happen in?
Crossplane version: v1.6.0
provider-kubernetes version: v0.3.0
The text was updated successfully, but these errors were encountered: