{{- if .Values.gcloudIngress.enabled }}
{{- if .Values.gcloudIngress.managedCertificates.enabled }}
---
apiVersion: networking.gke.io/v1beta1
kind: ManagedCertificate
metadata:
  name: {{ template "keel.fullname" . }}
  namespace: {{ .Release.Namespace }}
spec:
  domains:
    {{- range .Values.gcloudIngress.managedCertificates.domains }}
    - {{ . | title }}
    {{- end }}
{{- end }}

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "keel.fullname" . }}
  annotations:
  {{- if .Values.gcloudIngress.managedCertificates.enabled }}
    networking.gke.io/managed-certificates: {{ template "keel.fullname" . }}
  {{- end }}
    kubernetes.io/ingress.allow-http: "{{- .Values.gcloudIngress.allowHttp }}"
spec:
  backend:
    serviceName: {{ template "keel.fullname" . }}
    servicePort: 9300
{{- end }}
