_port.tpl 526 B

123456789101112131415
  1. {{/*
  2. Retrieve ports configuration for container
  3. */}}
  4. {{- define "common.containers.configurePorts" -}}
  5. {{- if .ports -}}
  6. ports:
  7. {{- range $index, $port := .ports -}}
  8. {{- include "common.schema.validateKeys" (dict "values" $port "checkKeys" (list "protocol" "containerPort")) }}
  9. - protocol: {{ $port.protocol }}
  10. containerPort: {{ $port.containerPort }}
  11. {{ if hasKey $port "hostPort" }}hostPort: {{ $port.hostPort }}{{ end }}
  12. {{ if hasKey $port "name" }}name: {{ $port.name }}{{ end }}
  13. {{- end -}}
  14. {{- end -}}
  15. {{- end -}}