{{- if .Values.ingress.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
{{- if .Values.ingress.annotations }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
{{- end }}
  name: {{ template "spinnaker.fullname" . }}-deck
  labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}
spec:
  rules:
  - host: {{ .Values.ingress.host | quote }}
    http:
      paths:
      {{- if index $.Values.ingress "annotations" }}
      {{- if eq (index $.Values.ingress.annotations "kubernetes.io/ingress.class" | default "") "gce" "alb" "nsx" }}
      - path: /*
      {{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
      - path: /
      {{- end }}
      {{- else}}{{/* Has no annotations */}}
      - path: /
      {{- end }}
        backend:
          serviceName: spin-deck
          servicePort: 9000
{{- if .Values.ingress.tls }}
  tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end }}
