_envDupeCheck.tpl 858 B

1234567891011121314151617181920212223
  1. {{/* Check Env for Duplicates */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.helper.container.envDupeCheck" (dict "rootCtx" $ "objectData" $objectData "source" $source "key" $key) }}
  4. rootCtx: The root context of the chart.
  5. objectData: The object data to be used to render the container.
  6. */}}
  7. {{- define "ix.v1.common.helper.container.envDupeCheck" -}}
  8. {{- $rootCtx := .rootCtx -}}
  9. {{- $objectData := .objectData -}}
  10. {{- $source := .source -}}
  11. {{- $type := .type -}}
  12. {{- $key := .key -}}
  13. {{- $dupeEnv := (get $objectData.envDupe $key) -}}
  14. {{- if $dupeEnv -}}
  15. {{- fail (printf "Container - Environment Variable [%s] in [%s] tried to override the Environment Variable that is already defined in [%s]" $key $source $dupeEnv.source) -}}
  16. {{- end -}}
  17. {{- $_ := set $objectData.envDupe $key (dict "source" $source) -}}
  18. {{- end -}}