apiVersion: v1
kind: Service
metadata:
  name: {{ template "fullname" . }}
spec:
  ports:
{{- if (.Values.httpPort) }}
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
{{- else if and (not .Values.http2Port) (not .Values.sslPort) }}
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
{{- end }}
{{- if (.Values.http2Port) }}
  - port: 81
    targetPort: http2
    protocol: TCP
    name: http2
{{- end }}
{{- if (.Values.sslPort) }}
  - port: 443
    targetPort: https
    protocol: TCP
    name: https
{{- end }}
  selector:
    app: {{ template "fullname" . }}
  type: {{ .Values.serviceType }}

