{{- if and .Values.global.huggingface.ingress.enabled .Values.ingress.enabled .Values.webhook.ingressInternal.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  {{- $annotations := fromYaml (include "datasetsServer.instance.ingressInternal.annotations" (dict "instance" .Values.webhook "context" $ )) }}
  annotations: {{ toYaml $annotations | nindent 4}}
  labels: {{ include "labels.webhook" . | nindent 4 }}
  name: "{{ include "name" . }}-webhook-internal"
  namespace: {{ .Release.Namespace }}
spec:
  rules:
    - host: internal.{{ 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 }}
