apiVersion: v1
kind: Service
metadata:
  name: {{ template "appmesh-gateway.fullname" . }}
  annotations:
    gateway.appmesh.k8s.aws/expose: "false"
    {{- if eq .Values.service.type "LoadBalancer" }}
    service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
    {{- end }}
  labels:
{{ include "appmesh-gateway.labels" . | indent 4 }}
spec:
  type: {{ .Values.service.type }}
  {{- if eq .Values.service.type "LoadBalancer" }}
  externalTrafficPolicy: Local
  {{- end }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: {{ include "appmesh-gateway.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
