{{- if .Values.exposeServices }}
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ template "openfaas.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    component: gateway
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
{{- if .Values.gatewayExternal.annotations }}
  annotations: {{ toYaml .Values.gatewayExternal.annotations | nindent 4 }}
{{- end }}
  name: gateway-external
  namespace: {{ .Release.Namespace | quote }}
spec:
  type: {{ .Values.serviceType }}
  ports:
    - name: http
      port: 8080
      protocol: TCP
      targetPort: 8080
      {{- if contains "NodePort" .Values.serviceType }}
      nodePort: {{ .Values.gateway.nodePort }}
      {{- end }}
  selector:
    app: gateway
  {{- end }}