fix: allow using function only to patch to and from the environment #122
+66
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From https://crossplane.slack.com/archives/CEG3T90A1/p1716529989392019:
Details
Hello, hopefully someone here can point me in the right direction.
I'm struggling a bit to understan pipeline context. My current assumption is that I should be able to run a function-patch-and-transform with a ToEnvironmentFieldPath patch to write a value to the context.
This is my setup:
$ crossplane version
Client Version: v1.16.0
Server Version: v1.15.2-up.1
XR from function-patch-and-transform multistep example
functions from function-patch-and-transform multistep example
composition from function-patch-and-transform multistep example with the addition below:
...
$ crossplane beta render xr.yaml composition.yaml function.yaml --include-context
...
54 │ ---
55 │ apiVersion: render.crossplane.io/v1beta1
56 │ fields:
57 │ apiextensions.crossplane.io/environment: {}
58 │ kind: Context
I'm expecting to see a key1 in apiextensions.crossplane.io/environment, but maybe this is not how it works?
The right approach was to instead define the following:
But it didn't work firstly because not specifying
spec.resources
wasn't allowed, which shouldn't be the case.But after faking a resource it was still failing because the environment was missing the gvk we expect and that crossplane would have set if it had passed an environment:
This PR fixes both issues.