{{- if and .Values.global.huggingface.ingress.enabled .Values.ingress.enabled .Values.webhook.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  {{- $annotations := fromYaml (include "datasetsServer.instance.ingress.annotations" (dict "instance" .Values.webhook "context" $ )) }}
  annotations: {{ toYaml $annotations | nindent 4}}
  labels: {{ include "labels.webhook" . | nindent 4 }}
  name: "{{ include "name" . }}-webhook"
  namespace: {{ .Release.Namespace }}
spec:
  rules:
    - host: {{ include "datasetsServer.ingress.hostname" . }}
      http:
        paths:
          - backend:
              service:
                name: "{{ include "name" . }}-webhook"
                port:
                  name: http
            path: /webhook
            pathType: Prefix
{{- include "ingress.tls" (merge (dict "annotations" $annotations) $ ) | indent 2}}
{{- end }}
