@@ -64,34 +64,56 @@ When deploying KServe with path-based routing alongside KubeFlow, you may encoun
6464- KubeFlow Central Dashboard and other services work normally
6565- KServe services work when accessed via different paths but not the root path
6666
67- ** Workaround:** Update the kubeflow-gateway to include your KServe ingress domain alongside the wildcard host :
67+ ** Workaround:** Align the hosts of VirtualServices created by KServe with the KubeFlow VirtualServices :
6868
6969``` yaml
70- # In your kustomization overlay or directly in kubeflow-istio-resources
71- apiVersion : networking.istio.io/v1alpha3
72- kind : Gateway
70+ apiVersion : kyverno.io/v1
71+ kind : ClusterPolicy
7372metadata :
74- name : kubeflow-gateway
73+ name : set-hosts-new-vs
74+ annotations :
75+ policies.kyverno.io/title : Override hosts of new Istio VirtualServices to align with other KubeFlow VirtualServices
7576spec :
76- selector :
77- istio : ingressgateway
78- servers :
79- - port :
80- number : 80
81- name : http
82- protocol : HTTP
83- hosts :
84- - " *" # Existing KubeFlow wildcard
85- - " your-kserve-domain.com" # Add your KServe ingress domain
77+ rules :
78+ - name : override-vs-hosts
79+ preconditions :
80+ all :
81+ - key : " {{ request.object.spec.hosts || [] }}"
82+ operator : NotEquals
83+ value : ["*"]
84+ # The problem happens only with VirtualServices for the `kubeflow-gateway` gateway
85+ - key : " {{ request.object.spec.gateways || []}}"
86+ operator : AnyIn
87+ value :
88+ - kubeflow/kubeflow-gateway
89+ - kubeflow-gateway
90+ # Make sure to ignore VirtualService with `mesh` gateway
91+ # Otherwise this will lead to connectivity problems between the KubeFlow dashboard and profile controller
92+ - key : " {{ request.object.spec.gateways || []}}"
93+ operator : AllNotIn
94+ value :
95+ - mesh
96+ match :
97+ any :
98+ - resources :
99+ kinds :
100+ - networking.istio.io/v1/VirtualService
101+ namespaceSelector :
102+ matchLabels :
103+ app.kubernetes.io/part-of : kubeflow-profile
104+ mutate :
105+ patchStrategicMerge :
106+ spec :
107+ hosts :
108+ - " *"
86109` ` `
87110
88111**Steps to apply the fix:**
89- 1. Identify your KServe ingress domain from the ` inferenceservice-config` ConfigMap
90- 2. Create a Kustomization overlay that patches the kubeflow-gateway
91- 3. Apply the updated configuration
112+ 1. Create the Kyverno policy
92113
93114**References:**
94115- Upstream Istio issue: https://github.com/istio/istio/issues/57404
116+ - Upstream KServe issue to make the host configurable: https://github.com/kserve/kserve/issues/4750
95117- KServe path-based routing documentation: https://kserve.github.io/website/docs/admin-guide/configurations#path-template
96118- Path-based routing test in CI: [.github/workflows/kserve_test.yaml](../../.github/workflows/kserve_test.yaml) (see ` test-basic-kserve` job)
97119- VirtualService path-based routing implementation : [tests/kserve_test.sh](../../tests/kserve_test.sh#L16-L42)
0 commit comments