Skip to content

Commit c3e71bd

Browse files
authored
[Cherry-Pick]regarding e2e fixes for predictor/path_based_routing (#514)
* add networkpolicy for kserve namespace Signed-off-by: Jooho Lee <[email protected]> * comment out runAsUser for e2e test in openshift Signed-off-by: Jooho Lee <[email protected]> * cherrypick upstream 4276 Signed-off-by: Jooho Lee <[email protected]> --------- Signed-off-by: Jooho Lee <[email protected]>
1 parent b0a34b2 commit c3e71bd

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

config/runtimes/kserve-torchserve.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ spec:
2727
- name: "TS_SERVICE_ENVELOPE"
2828
value: "{{.Labels.serviceEnvelope}}"
2929
securityContext:
30-
runAsUser: 1000 # User ID is not defined in the Dockerfile, so we need to set it here to run as non-root
30+
# In OpenShift, the UID is automatically assigned by the platform, so comment this field not to interfere with E2E tests.
31+
# runAsUser: 1000 # User ID is not defined in the Dockerfile, so we need to set it here to run as non-root
3132
allowPrivilegeEscalation: false
3233
privileged: false
3334
runAsNonRoot: true

config/runtimes/kserve-tritonserver.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ spec:
4343
- --allow-grpc=true
4444
- --allow-http=true
4545
securityContext:
46-
runAsUser: 1000 # https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/customization_guide/deploy.html#run-as-a-non-root-user
46+
# In OpenShift, the UID is automatically assigned by the platform, so comment this field not to interfere with E2E tests.
47+
# runAsUser: 1000 # https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/customization_guide/deploy.html#run-as-a-non-root-user
4748
allowPrivilegeEscalation: false
4849
privileged: false
4950
runAsNonRoot: true

test/e2e/predictor/test_autoscaling.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ async def test_sklearn_scale_raw(rest_v1_client):
225225
@pytest.mark.asyncio(scope="session")
226226
async def test_sklearn_rolling_update():
227227
service_name = "isvc-sklearn-rolling-update"
228-
min_replicas = 4
228+
min_replicas = 2
229229
predictor = V1beta1PredictorSpec(
230230
min_replicas=min_replicas,
231231
scale_metric="cpu",
@@ -277,14 +277,14 @@ async def test_sklearn_rolling_update():
277277
kserve_client.wait_isvc_ready(service_name, namespace=KSERVE_TEST_NAMESPACE)
278278

279279
kserve_client.patch(service_name, updated_isvc)
280-
deployment = kserve_client.app_api.list_namespaced_deployment(
281-
namespace=KSERVE_TEST_NAMESPACE,
282-
label_selector="serving.kserve.io/test=rolling-update",
283-
)
284280
kserve_client.wait_isvc_ready(
285281
service_name, namespace=KSERVE_TEST_NAMESPACE, timeout_seconds=600
286282
)
287283

284+
deployment = kserve_client.app_api.list_namespaced_deployment(
285+
namespace=KSERVE_TEST_NAMESPACE,
286+
label_selector="serving.kserve.io/test=rolling-update",
287+
)
288288
# Check if the deployment replicas still remain the same as min_replicas
289289
assert deployment.items[0].spec.replicas == min_replicas
290290
kserve_client.delete(service_name, KSERVE_TEST_NAMESPACE)

test/scripts/openshift-ci/setup-e2e-tests.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,24 @@ kustomize build $PROJECT_ROOT/config/overlays/test/clusterresources |
172172
# no effect, because of missing Knative
173173
oc annotate servingruntimes -n kserve-ci-e2e-test --all serving.knative.openshift.io/enablePassthrough=true
174174

175+
176+
# Allow all traffic to the kserve namespace. Without this networkpolicy, webhook will return 500
177+
# error msg: 'http: server gave HTTP response to HTTPS client"}]},"code":500}'
178+
cat <<EOF | oc apply -f -
179+
apiVersion: networking.k8s.io/v1
180+
kind: NetworkPolicy
181+
metadata:
182+
name: allow-all
183+
namespace: kserve
184+
spec:
185+
podSelector: {}
186+
ingress:
187+
- {}
188+
egress:
189+
- {}
190+
policyTypes:
191+
- Ingress
192+
- Egress
193+
EOF
194+
175195
echo "Setup complete"

0 commit comments

Comments
 (0)