{{- if .Values.catalog.ingress.enabled}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "iceberg-catalog.fullname" . }}
  {{- if .Values.catalog.ingress.annotations }}
  annotations:
    {{- toYaml .Values.catalog.ingress.annotations | nindent 4 }}
  {{- end }}
  labels:
    {{- include "iceberg-catalog.labels" . | nindent 4 }}
    app.kubernetes.io/component: catalog
    {{- if .Values.catalog.ingress.labels }}
    {{- toYaml .Values.catalog.ingress.labels | nindent 4 }}
    {{- end }}
spec:
  {{- if .Values.catalog.ingress.tls.enabled }}
  tls:
    - hosts:
        - {{ .Values.catalog.ingress.host }}
      {{- if .Values.catalog.ingress.tls.secretName }}
      secretName: {{ .Values.catalog.ingress.tls.secretName }}
      {{- end }}
  {{- end }}
  {{- if .Values.catalog.ingress.ingressClassName }}
  ingressClassName: {{ .Values.catalog.ingress.ingressClassName }}
  {{- end }}
  rules:
    - host: {{ .Values.catalog.ingress.host }}
      http:
        paths:
          - path: {{ .Values.catalog.ingress.path }}
            pathType: ImplementationSpecific
            backend:
              service:
                name: {{ include "iceberg-catalog.fullname" . }}
                port:
                  name: http
{{- end }}
