Skip to content

Instantly share code, notes, and snippets.

@shivanshs9
Created March 1, 2025 05:10
Show Gist options
  • Save shivanshs9/2922455353868eef0ed4c846aa20c5e9 to your computer and use it in GitHub Desktop.
Save shivanshs9/2922455353868eef0ed4c846aa20c5e9 to your computer and use it in GitHub Desktop.
{{/*
Because of Helm bug (https://github.com/helm/helm/issues/3001), Helm converts
int value to float64 implictly, like 2748336 becomes 2.748336e+06.
This breaks the output even when using quote to render.
Use this function when you want to get the string value only.
It handles the case when the value is string itself as well.
Parameters: is string/number
*/}}
{{- define "stringOrNumber" -}}
{{- if kindIs "string" . }}
{{- print . -}}
{{- else }}
{{- int64 . | toString -}}
{{- end -}}
{{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment