Last active
May 12, 2023 08:40
-
-
Save ofen/5f5d3e8a9ddee33455ab922f4df07fea to your computer and use it in GitHub Desktop.
Helm helper to convert label map to comma-separated string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{/* | |
Convert labels to string like: key1="value1", key2="value2", ... | |
*/}} | |
{{- define "chart.external_labels" -}} | |
{{- $list := list -}} | |
{{- range $k, $v := .Values.external_labels -}} | |
{{- $list = append $list (printf "%s=\"%s\"" $k $v) -}} | |
{{- end -}} | |
{{ join ", " $list }} | |
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
external_labels: | |
cluster-location: lab | |
cluster-name: test-cluster01 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to convert below template.