Open irizzant opened 1 day ago
This is a strange question, and I'm not sure if the upstream community has encountered it before. I have confirmed that the logic in function-kcl is correct and the unit testing is passed. Perhaps it's a problem with the crossplane runtime. What is your crossplane version?
I'm running Crossplane 1.17.1 in kubernetes 1.30
I see. Is it because the function-kcl version in the cluster is too low and does not support extraResources yet, which may result in different results from cross plane rendering?
You were probably right about the wrong function-kcl version, nice catch!
I made sure that version 0.10.1 is installed, and this is the current output showing the right version is now applied:
NAME INSTALLED HEALTHY PACKAGE AGE
crossplane-contrib-function-auto-ready True True xpkg.upbound.io/crossplane-contrib/function-auto-ready:v0.2.1 27m
crossplane-contrib-function-kcl True True xpkg.upbound.io/crossplane-contrib/function-kcl:v0.10.1 27m
Now when I use this extra resources:
apiVersion = "meta.krm.kcl.dev/v1alpha1"
kind = "ExtraResources"
requirements = {
test = {
apiVersion = "platform.eng.it/v1alpha1"
kind = "Project"
matchName = "example-project"
}
}
}]
I get a different error:
ReconcileError: cannot compose resources: cannot run Composition pipeline step "kcl": fetching resources for test: cannot get extra resource by name: an empty namespace may not be set when a resource name is provided
@Peefy I've also added this simple reproducer for the issue: https://github.com/irizzante/function-kcl-issue-172
You can launch setup.sh and then:
kubectl describe testxr
@irizzant I see. Thank you! I will check it later. The extra resource feature was originally implemented in #162 by @fraenkel .
@fraenkel Sorry to bother you, I want to ask have you encountered similar issues?
I've found the related issue: https://github.com/crossplane-contrib/function-extra-resources/issues/27 @irizzant
Hi @Peefy
ok so function-extra-resources accepts only cluster-scoped resources, but what is the relation with this issue?
Does function-kcl use function-extra-resources under the hood?
Since the matchLabels field allows for namespaced resources, shouldn't it be fixed?
Errors seem emerge from the crossplane rather than in the function-kcl đŸ¤”
Are you suggesting that in: https://github.com/crossplane/crossplane/blob/e3b2f5685079f141d42400edd10848adff127930/internal/controller/apiextensions/composite/extra_resources.go#L122
there should be something like this?
nn := types.NamespacedName{Name: rs.GetMatchName(), Namespace: "your-namespace"}
What happened?
I have the following Extra Resources defined
which matches the following project definition:
I then try to use this resource inside a Composition like this:
But the end result is that the test annotation is empty in my kubernetes cluster:
Instead, when I try to run
crossplane beta render
and specify the following manifest as extra resource:I get a different result and the annotation is loaded:
How can we reproduce it?
What environment did it happen in?
Function version: 0.10.1