apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: "drycc-monitor-grafana-ingress"
  labels:
    app: "drycc-monitor-grafana"
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  annotations:
    kubernetes.io/tls-acme: "true"
    {{- if not (eq .Values.global.ingress_class "") }}
    kubernetes.io/ingress.class: "{{ .Values.global.ingress_class }}"
    {{ end }}
spec:
  rules:
  - host: drycc-monitor-grafana.{{ .Values.global.platform_domain }}
    http:
      paths:
      {{- if eq .Values.global.ingress_class "gce" "alb" }}
      - path: /*
      {{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
      - path: /
      {{- end }}
        backend:
          serviceName: drycc-monitor-grafana
          servicePort: 80
  {{ if .Values.global.cert_manager_enabled }}
  tls:
    - secretName: drycc-monitor-grafana-auto-tls
      hosts:
        - drycc-monitor-grafana.{{ .Values.global.platform_domain }}
  {{- end }}
