apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: "drycc-monitor-grafana"
  labels:
    app: "drycc-monitor-grafana"
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  annotations:
    kubernetes.io/tls-acme: "true"
spec:
  {{- if not (eq .Values.global.ingressClass "") }}
  ingressClassName: "{{ .Values.global.ingressClass }}"
  {{ end }}
  rules:
  - host: drycc-monitor-grafana.{{ .Values.global.platformDomain }}
    http:
      paths:
      - pathType: Prefix
        {{- if eq .Values.global.ingressClass "gce" "alb" }}
        path: /*
        {{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
        path: /
        {{- end }}
        backend:
          service:
            name: drycc-monitor-grafana
            port: 
              number: 80
  {{ if .Values.global.certManagerEnabled }}
  tls:
    - secretName: drycc-monitor-grafana-auto-tls
      hosts:
        - drycc-monitor-grafana.{{ .Values.global.platformDomain }}
  {{- end }}
