apiVersion: v1 kind: Service metadata: name: {{ include "metapi.fullname" . }} labels: {{- include "metapi.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} selector: app.kubernetes.io/name: {{ include "metapi.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} ports: - name: http port: {{ .Values.service.port }} targetPort: http {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePort }} nodePort: {{ .Values.service.nodePort }} {{- end }}