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