{{- range $name, $component := .Values.components }} --- apiVersion: v1 kind: Service metadata: name: {{ include "chart.componentFullname" (dict "root" $ "name" $name) }} labels: {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 4 }} spec: type: {{ $component.service.type }} ports: - port: {{ $component.service.port }} targetPort: {{ $component.service.portName | default "http" }} protocol: TCP name: {{ $component.service.portName | default "http" }} {{- with $component.service.nodePort }} nodePort: {{ . }} {{- end }} selector: {{- include "chart.componentSelectorLabels" (dict "root" $ "name" $name) | nindent 4 }} {{- end }}