apiVersion: v1
kind: Service
metadata:
  name: {{ include "nginx.fullname" . }}
  labels:
    {{- include "nginx.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  # Make sure to get client ip
  externalTrafficPolicy: Local
  ports:
    {{- range .Values.service.ports }}
    - port: {{ .port }}
      targetPort: {{ .targetPort }}
      protocol: TCP
      name: {{ .targetPort }}
    {{- end }}
  selector:
    {{- include "nginx.selectorLabels" . | nindent 4 }}
