Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semi-Bug: CRDs with {{}} cause issues with helm, if CRD templating is enabled #142

Open
tamcore opened this issue Apr 19, 2024 · 0 comments

Comments

@tamcore
Copy link

tamcore commented Apr 19, 2024

Issue
Sometimes upstream CRDs have things like {{ .cluster.name }}-{{ .random }} in their description fields (like the ClusterClass CRD of cluster-api, see bellow), which should be present as-is in the final helm output / installation. But because {{ and }} are interpreted by helm, that leads to errors during templating.

Desired solution
Have helmify detect usage of {{}} in the provided manifests and replace them with

{{`{{

and

}}`}}

respectively. As shown bellow in the workaround.

How to reproduce
Create chart

curl -sL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.0/core-components.yaml | \
  go run github.com/arttor/helmify/cmd/helmify@v0.4.11 -vv

and then try to render the generated chart

$ helm template .
zsh: correct 'template' to 'templates' [nyae]? n
Error: template: chart/templates/clusterclass-crd.yaml:679:74: executing "chart/templates/clusterclass-crd.yaml" at <.cluster.name>: nil pointer evaluating interface {}.name

Use --debug flag to render out invalid YAML

Workaround
exists by wrapping the {{}} as part of the pipeline

curl -sL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.0/core-components.yaml | \
  sed -e 's@{{@{{`{{@g' -e 's@}}@}}`}}@g' | \
  go run github.com/arttor/helmify/cmd/helmify@v0.4.11 -vv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant