_environment.tpl 873 B

123456789101112131415161718192021
  1. {{/*
  2. Render environment variables
  3. */}}
  4. {{- define "common.containers.environmentVariables" -}}
  5. {{- $values := . -}}
  6. {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "environmentVariables")) -}}
  7. {{- range $envVariable := $values.environmentVariables -}}
  8. {{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "name")) -}}
  9. - name: {{ $envVariable.name }}
  10. {{- if $envVariable.valueFromSecret -}}
  11. {{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "secretName" "secretKey")) -}}
  12. valueFrom:
  13. secretKeyRef:
  14. name: {{ $envVariable.secretName }}
  15. key: {{ $envVariable.secretKey }}
  16. {{- else -}}
  17. {{- include "common.schema.validateKeys" (dict "values" $envVariable "checkKeys" (list "value")) -}}
  18. value: {{ $envVariable.value }}
  19. {{- end -}}
  20. {{- end -}}
  21. {{- end -}}