configmaps.yaml 1.1 KB

123456789101112131415161718192021222324252627282930
  1. {{- $name := .Chart.Name }}
  2. {{- $globalAnnotationsCheck := include "global.annotations.check" . }}
  3. {{- range $index, $val := .Values.items }}
  4. {{- if not (empty $val.containers) }}
  5. {{- range $Index, $Containers := $val.containers }}
  6. {{- if and $Containers.configMap $Containers.configMap.enabled $Containers.configMap.data }}
  7. apiVersion: v1
  8. kind: ConfigMap
  9. metadata:
  10. {{- if or $val.annotations $globalAnnotationsCheck }}
  11. annotations:
  12. {{- if and $val.annotations (not (eq $val.type "global")) }}
  13. {{- toYaml $val.annotations | nindent 4 }}
  14. {{- end }}
  15. {{- if $globalAnnotationsCheck }}
  16. {{- range $Index, $Val := $.Values.items }}
  17. {{- if eq $Val.type "global" }}
  18. {{- toYaml $Val.annotations | nindent 4 }}
  19. {{- end }}{{- end }}{{- end }}
  20. {{- end }}
  21. labels:
  22. app: {{ $name }}
  23. tier: {{ $val.name | default (print $name) }}-config
  24. name: {{ $Containers.configMap.name | default (print $name "-config") }}
  25. data:
  26. {{- range $key, $value := $Containers.configMap.data }}{{- if $value }}
  27. {{- printf "%v: %v" $key (printf "%v" $value | quote) | nindent 2 }}
  28. {{- end }}{{- end }}
  29. {{ print "---" }}
  30. {{- end }}{{- end }}{{- end }}{{- end }}