crossplane-contrib / function-go-templating

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

Support writing to Context #66

Open phisco opened 5 months ago

phisco commented 5 months ago

What problem are you facing?

Currently this function allows reading from the Context:

{{- $environmentConfig := index .context "apiextensions.crossplane.io/environment" }}

But one can not write to the context.

How could this Function help solve your problem?

Adding a Context resource similar to what already done with CompositeConnectionDetails, could be an option.

apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: Context
data:
  apiextensions.crossplane.io/environment: ....
  another.key: ...

TBD how to handle it w.r.t. the input Context, we could replace it altogether, but merging could be a little bit hard with this function, probably it's the best thing to do though.

ma-ble commented 5 months ago

Thank you for opening the enhancement.