{{- if $.Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }}
  labels: {{ include "labels.standard" . | nindent 4 }}
  name: {{ include "name" . }}
  namespace: {{ .Release.Namespace }}
spec:
  {{ if $.Values.ingress.className }}
  ingressClassName: {{ .Values.ingress.className }}
  {{ end }}
  {{- with .Values.ingress.tls }}
  tls:
    - hosts:
        - {{ $.Values.domain | quote }}
      {{- with .secretName }}
      secretName: {{ . }}
      {{- end }}
  {{- end }}
  rules:
    - host: {{ .Values.domain }}
      http:
        paths:
          - backend:
              service:
                name: {{ include "name" . }}
                port:
                  name: http
            path: {{ $.Values.ingress.path | default "/" }}
            pathType: Prefix
{{- end }}
