crossplane-contrib / function-go-templating

A Go templating composition function
https://crossplane.io
Apache License 2.0
52 stars 33 forks source link

Not able to report the status back to XR #101

Closed ajaysurapaneni closed 1 month ago

ajaysurapaneni commented 3 months ago

We have a composition which uses go-template functions and terraform provider to get the existing aws vpc information. This composition also has to report the status back to claim.

yairyairyair commented 1 month ago

can we please get some feedback on it? i really need this feature and its basically making the whole GoTemplate function unusable. can also you provide use with a simple example of kind: Bucket and just updating its .status field based on the managed resources?

if i can help let me know i really need this feature its a blocker for me

jbw976 commented 1 month ago

It should be possible to write to the XR's .status field, as Nic mentions in this comment: https://github.com/crossplane/crossplane/issues/4968#issuecomment-1793582438

It's not possible to modify the XR's .spec and .metadata (as captured in https://github.com/crossplane/crossplane/issues/5434), but .status should be supported.

Do you have the status field(s) that you are writing to defined in the XRD also? That's one common issue that prevents data from being written/saved to .status.

yairyairyair commented 1 month ago

I have the status field in the crd. I do have lack of knowledge in this GoTemplate function, can we maybe add an example for it that updates status.

Maybe like the custom bucket composite example.

Anyway will ask for specific syntax help on the slack

patst commented 1 month ago

I have the status field in the crd. I do have lack of knowledge in this GoTemplate function, can we maybe add an example for it that updates status.

Maybe like the custom bucket composite example.

Anyway will ask for specific syntax help on the slack

https://github.com/crossplane-contrib/function-go-templating/blob/main/example/functions/toYaml/composition.yaml#L22 this example demonstrates how to write to the status.

To be honest it wasn't very clear to me as well, but the examples folder helps a lot. (Even if the naming of the directories is not very clear :-) )