{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "common.names.fullname" . }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
  annotations:
    {{- if .Values.ingress.annotations }}
    {{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
  {{- end }}
spec:
  tls:
  {{- if .Values.ingress.tls }}
    - hosts:
        - {{ .Values.ingress.hostname | quote }}
      secretName: {{ .Values.ingress.tlsSecretname }}
  {{- end }}
  rules:
    - host: {{ .Values.ingress.hostname | quote }}
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: {{ include "common.names.fullname" . }}
                port:
                  name: http
{{- end }}