Description
What happened?
I have a composition which is configured to inject kubernetes secret by using "credentials" config. Upon loading this secret inside my composite function, fetching the credential data by using "resource.get_credentials()", I 'm receiving below error:
crossplane: error: cannot render composite resource: cannot run pipeline step "postInstallActivities": rpc error: code = Unknown desc = Unexpected <class 'ValueError'>: Field apiextensions.fn.proto.v1.RunFunctionRequest.credentials does not have presence.
While the RunFunctionRequest has the credential field in it, but looks like there is change in the schema.
Below is the RunFunctionRequest struct:
observed { composite { resource { fields { key: "spec" value { struct_value { } } } } } } } desired { } context { } credentials { key: "app1" value { credential_data { data { key: "init_key" value: "redacted" } } } } credentials { key: "app2" value { credential_data { data { key: "init_key" value: "redacted" } } } }
Expected Behavior: "resource.get_credentials()" should properly fetch the Credentials from the RunFunctionRequest and return credential type and data.
How can we reproduce it?
-
Configure a composition to run a composite function and enable config = credentials to reference the secret.
`apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: postInstall
spec:
compositeTypeRef:
apiVersion: product.example.org/v1
kind: postInstall
mode: Pipeline
pipeline:- step: postInstallStep
functionRef:
name: function-post-install
credentials:- name: app1
source: Secret
secretRef:
namespace: app1
name: app1-secret - name: app2
source: Secret
secretRef:
namespace: app2
name: app2-secret`
- name: app1
- step: postInstallStep
-
Develop a composite function to instantiate Credentials with - 'resource.get_credentials(req, "app1")'
-
In an ideal case, the Credentials should be instantiated with type and data.
What environment did it happen in?
Function version: v0.6.0
- Crossplane version: v1.18.1
- Cloud provider or hardware configuration: Azure, Minikube
- Kubernetes version: v1.29
- Kubernetes distribution : AKS, Minikube
- OS: Mac
- Kernel: Darwin, arm64