Open davejhahn opened 9 months ago
Doing some more debugging and it seems that the problem is not that it cannot patch metadata, but it can't patch using CombineFromEnvironment.
e.g. if I provide the external name in the XR (which is not what I want to do, but just for testing):
- type: FromCompositeFieldPath
fromFieldPath: spec.externalName
toFieldPath: annotations[crossplane.io/external-name]
It sets the annotation as expected. But when I use CombineFromEnvironment it does not.
Also, just tried doing a patch with FromEnvironmentFieldPath, not a value that would work for the provider, but just to see if it sets it and it does:
- type: FromEnvironmentFieldPath
fromFieldPath: storage.accountReplicationType
toFieldPath: metadata.annotations[crossplane.io/external-name]
So it seems that CombineFromEnvironment doesn't patch properly in function-patch-and-transform, unless I'm just doing something wrong.
And reiterating, CombineFromEnvironment, doing the same exact thing, in a composition that just has a resource instead of a pipeline, it works as expected.
Updated title to reflect myfindings.
Hey @davejhahn, have you been able to test a build with https://github.com/crossplane-contrib/function-patch-and-transform/pull/55? I don't think the latest release includes this fix.
@stevendborrelli no I have not, but will try now.
@stevendborrelli just a clarification, is there an image already pushed to xpkg.upbound.io/crossplane-contrib/function-patch-and-transform with this version or do I need to build it?
You might be able to use the version from the pull request xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.0.0-20231130064014-75b5a45cf119
Ok, tried that version, doesn't seem to have resolved what I was seeing. I will try and get a package created from #55 above. I just haven't gotten to the point of pushing functions to our container registry and need to work through that.
@stevendborrelli I was able to build and create a package, push to our private CR and deploy the function, for the PR #55, but the problem still persists unfortunately.
Have you been able to achieve something like this @davejhahn ?
@davejhahn this issue should be fixed by https://github.com/crossplane-contrib/function-patch-and-transform/pull/78 and https://github.com/crossplane-contrib/function-patch-and-transform/pull/96. Can you confirm this?
I've migrated from a resource composition to a pipeline and have been able to get everything to work except the patching of the annotation, so it defaults to the generated name preventing the resource from being created because it is not valid for the provider
Everything else appears to patch correctly. I also tried patching the same thing to "metadata.name" and it also does not patch.
When I run the same from a resource composition it patches as expected.