{{- if .Values.createIngress }}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
{{- if or .Values.ingressAnnotations .Values.gke.useGKEIngress }}
  annotations:
{{- range $key, $value := $.Values.ingressAnnotations }}
    {{ $key }}: {{ $value | quote }}
{{- end }}
  {{- if .Values.gke.ingress.useGKEIngress }}
    kubernetes.io/ingress.class: gce
    {{- if .Values.gke.ingress.useManagedCertificate }}
    kubernetes.io/ingress.allow-http: "false"
    networking.gke.io/managed-certificates: fleet
    {{- end }}
  {{- end }}
{{- end }}
  labels:
    app: fleet
    chart: fleet
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: fleet
  namespace: {{ .Release.Namespace }}
spec:
  rules:
  - host: {{ .Values.hostName }}
    http:
      paths:
      - path: /*
        # Next line required in k8s 1.19 and not supported in <=1.17
        # pathType: Exact
        backend:
          serviceName: fleet
          servicePort: fleet
{{- end }}
