{{- if ne .Values.service.nodePort.enabled true }}
apiVersion: v1
kind: Service
metadata:
  name: istio-ingress
  labels:
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    istio: ingress
spec:
  type: LoadBalancer
  ports:
  - port: 80
    name: http
  - port: 443
    name: https
  selector:
    istio: ingress
{{- end }}

---
{{- if .Values.service.nodePort.enabled }}
# Using separate ingress for nodeport, to avoid conflict with pilot e2e test configs.
apiVersion: v1
kind: Service
metadata:
  name: istio-ingress-nodeport
  labels:
    app: {{ template "istio.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    istio: ingress
spec:
  type: NodePort
  ports:
  - port: 80
    {{- if .Values.service.nodePort.port }}
    nodePort: {{ .Values.service.nodePort.port }}
    {{- end }}
    name: http
  - port: 443
    name: https
  selector:
    istio: ingress
{{- end }}
