_configmap.tpl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. {{/* Configmap Class */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.class.configmap" (dict "rootCtx" $ "objectData" $objectData) }}
  4. rootCtx: The root context of the chart.
  5. objectData:
  6. name: The name of the configmap.
  7. labels: The labels of the configmap.
  8. annotations: The annotations of the configmap.
  9. data: The data of the configmap.
  10. */}}
  11. {{- define "ix.v1.common.class.configmap" -}}
  12. {{- $rootCtx := .rootCtx -}}
  13. {{- $objectData := .objectData }}
  14. ---
  15. apiVersion: v1
  16. kind: ConfigMap
  17. metadata:
  18. name: {{ $objectData.name }}
  19. {{- $labels := (mustMerge ($objectData.labels | default dict) (include "ix.v1.common.lib.metadata.allLabels" $rootCtx | fromYaml)) -}}
  20. {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "labels" $labels) | trim) }}
  21. labels:
  22. {{- . | nindent 4 }}
  23. {{- end -}}
  24. {{- $annotations := (mustMerge ($objectData.annotations | default dict) (include "ix.v1.common.lib.metadata.allAnnotations" $rootCtx | fromYaml)) -}}
  25. {{- with (include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $rootCtx "annotations" $annotations) | trim) }}
  26. annotations:
  27. {{- . | nindent 4 }}
  28. {{- end }}
  29. data:
  30. {{- tpl (toYaml $objectData.data) $rootCtx | nindent 2 }}
  31. {{/* This comment is here to add a new line */}}
  32. {{- end -}}