-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Error in rendering XRs are not propagated to Claims #3262
Description
Note: The issue of map transform failing is just one example of a case where rendering can fail. The real issue is that any rendering error isn't visible for the user interacting with the claim.
What happened?
When patching with a Map transform, if the key doesn't exist it silently fails to apply the patch (snippet below).
The composition will stay not ready, with a spec only with 1 condition:
conditions:
- lastTransitionTime: '2022-08-23T15:09:44Z'
reason: Creating
status: 'False'
type: ReadyOnly in the logs we can see that it fails applying with an error like this:
1.6612685509865906e+09 DEBUG crossplane.events Warning {"object": {... "reason": "ComposeResources", "message": "cannot render composed resource from resource template at index 2: cannot apply the patch at index 6: transform at index 0 returned error: map transform could not resolve: key asdf is not found in map"}
tl;dr: "map transform could not resolve: key asdf is not found in map"(this error also is only visible when enabling the debug flag in the args for the crossplane container, e.g. core start --debug)
I would expect that the composition receives an additional status condition with the error message, so that it's easier to notice an error when rendering. I consider seeing no errors or status conditions like this by default as a "silent ignore" and therefore a bug, as it's not user friendly to troubleshoot.
(kubectl describe <the-composition> does list the warning as an event though, but it's not propagated to the claim.)
How can we reproduce it?
Composition with patch and a map transform with specific set of keys, like this:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.region
transforms:
# Any other value from spec.parameters.region result in an silent error.
- type: map
map:
rma: Rümlang
lpg: LupfigThen, in the claim's parameter, set a value that doesn't exist in the above map (neither rma nor lpg).
What environment did it happen in?
Crossplane version: v1.9