crossplane-contrib / function-go-templating

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

Docs: Clarification on where go templating variables come from and their meaning? #72

Closed danielloader closed 7 months ago

danielloader commented 7 months ago

What problem are you facing?

I don't understand the context, and content of the documented examples on the readme:

    {{ .observed.composite.resource.metadata.name }}
    {{ .desired.composite.resource.status.widgets }}
    {{ (index .desired.composed "resource-name").resource.spec.widgets }}
    {{ index .context "apiextensions.crossplane.io/environment" }}

What is the difference between observed/desired? Is this a naming convention?

How could this Function help solve your problem?

Document the go-template variables I can use, how they come to exist, and what can I do with them.

Essentially some more detailed usage examples would be welcome.

Thanks!

phisco commented 7 months ago

You can find a bit more context here https://docs.crossplane.io/latest/concepts/composition-functions/#how-composition-functions-work, and here for the full protobuf definition, https://buf.build/crossplane/crossplane/docs/main:apiextensions.fn.proto.v1beta1#apiextensions.fn.proto.v1beta1.RunFunctionRequest

danielloader commented 7 months ago

I also just found https://docs.crossplane.io/latest/concepts/composition-functions/#observed-state and https://docs.crossplane.io/latest/concepts/composition-functions/#desired-state.

My bad!