Go Templating #404
wasabii
started this conversation in
Ideas & General Discussion
Replies: 1 comment 3 replies
-
I happen to have a need for this currently in my operator. So my approach right now is going to be to include a Handlebars template, since there is a well-designed and maintained Handlebars.NET package. But this is unfortunate, as my CRDs won't fit into the overall K8s ecosystem as cleanly. The proper solution would probably be a DotNet native implementation of Go templates. A less good solution would be invoking the Go lang template engine from within a DotNet operator. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So, this is more of a discussion topic. I am aware there is no easy answer for this.
There is a general pattern of developing Kubernetes operators that generate other objects using Golang templates embedded as strings within a CRD. An example is the 'ExternalSecret' type, which supports pulling values from Azure Keyvault, etc, into K8S Secrets.
The 'ExternalSecret' CRD, for example, allows you to simply put a Golang template into the body of a Spec property, and the operator executes that template against the external secret data, allowing you to format the contents of the external secret.
https://external-secrets.io/v0.4.4/guides-templating/
Since K8s is so go-y, this makes good sense. It fits nicely into the eco system.
However, this presents an issue when using The DotNet operator! We don't have access to Go-lang templates! What to do!
Beta Was this translation helpful? Give feedback.
All reactions