apiVersion: v1 kind: Service metadata: name: {{ include "mailproxy.fullname" . }}-nginx labels: {{- include "mailproxy.labels" . | nindent 4 }} annotations: {{- toYaml .Values.nginx.service.annotations | nindent 4 }} spec: type: {{ .Values.nginx.service.type }} ports: {{- range $i, $port := .Values.nginx.service.ports }} - port: {{ $port.number }} targetPort: {{ $port.number }} protocol: {{ $port.protocol }} name: {{ $port.name }} {{- end }} externalTrafficPolicy: {{ .Values.nginx.service.externalTrafficPolicy }} selector: {{- include "mailproxy.nginx.selectorLabels" . | nindent 4 }}