{{- /* Service names are the compose service names, verbatim: the portals' Caddy proxies to http://bff:8080 and the upstream setup_configuration files name http://openzaak:8000 / http://nrc-web:8000, so in-cluster DNS has to answer to exactly those names. Do not rename a workload without checking both. .Values.nodePorts is the single place a port is published outside the cluster; a workload listed there gets a NodePort on its first (only) port. */ -}} {{- range $name, $w := .Values.workloads }} {{- if and (ne $w.enabled false) $w.ports }} {{- $nodePort := index $.Values.nodePorts $name }} --- apiVersion: v1 kind: Service metadata: name: {{ $name }} labels: {{- include "big.labels" (dict "root" $ "name" $name) | nindent 4 }} spec: type: {{ if $nodePort }}NodePort{{ else }}ClusterIP{{ end }} selector: app.kubernetes.io/name: {{ $name }} app.kubernetes.io/instance: {{ $.Release.Name }} ports: {{- range $i, $p := $w.ports }} - name: {{ $p.name }} port: {{ $p.port }} targetPort: {{ $p.targetPort | default $p.port }} {{- if and $nodePort (eq $i 0) }} nodePort: {{ $nodePort }} {{- end }} {{- end }} {{- end }} {{- end }}