diff --git a/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonDeploymentOperatorImpl.java b/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonDeploymentOperatorImpl.java index 8596998754..b4a1822604 100644 --- a/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonDeploymentOperatorImpl.java +++ b/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonDeploymentOperatorImpl.java @@ -808,7 +808,7 @@ public DeploymentResources createResources(SeldonDeployment mlDep) throws Seldon .setMetadata(ObjectMeta.newBuilder() .setName(containerServiceValue) .putLabels(containerServiceKey, containerServiceValue) - .putLabels("seldon-deployment-id", mlDep.getSpec().getName()) + .putLabels("seldon-deployment-id", seldonId) .addOwnerReferences(ownerRef) ); ServiceSpec.Builder svcSpecBuilder = ServiceSpec.newBuilder(); diff --git a/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonNameCreator.java b/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonNameCreator.java index eed4e17f15..cd95d9085a 100644 --- a/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonNameCreator.java +++ b/cluster-manager/src/main/java/io/seldon/clustermanager/k8s/SeldonNameCreator.java @@ -13,6 +13,17 @@ private String hash(String key) { return DigestUtils.md5Hex(key).toLowerCase().substring(0, 7); } + private String createPredictorHash(PredictorSpec pred) + { + StringBuffer sb = new StringBuffer(); + for(SeldonPodSpec podSpec : pred.getComponentSpecsList()) + { + sb.append(createContainerHash(podSpec)); + sb.append(","); + } + return hash(sb.toString()); + } + private String createContainerHash(SeldonPodSpec spec) { StringBuffer sb = new StringBuffer(); @@ -46,7 +57,7 @@ protected static String cleanContainerImageName(String name) public String getServiceOrchestratorName(SeldonDeployment dep,PredictorSpec pred) { - String svcName = dep.getSpec().getName() + "-" + pred.getName()+"-svc-orch"; + String svcName = dep.getSpec().getName() + "-" + pred.getName()+"-svc-orch" + "-" + createPredictorHash(pred); if (svcName.length() > 63) return "seldon-"+hash(svcName); else diff --git a/cluster-manager/src/test/java/io/seldon/clustermanager/k8s/End2EndSeparateEngineTest.java b/cluster-manager/src/test/java/io/seldon/clustermanager/k8s/End2EndSeparateEngineTest.java index ad06ec52fd..cf080b8687 100644 --- a/cluster-manager/src/test/java/io/seldon/clustermanager/k8s/End2EndSeparateEngineTest.java +++ b/cluster-manager/src/test/java/io/seldon/clustermanager/k8s/End2EndSeparateEngineTest.java @@ -40,7 +40,7 @@ public void testSimpleModel() throws Exception verify(mockProtoClient,Mockito.times(2)).create(argument.capture(), any(String.class), any(String.class), Mockito.matches("Deployment")); Deployment d = argument.getAllValues().get(0); - Assert.assertEquals("test-deployment-fx-market-predictor-svc-orch", d.getMetadata().getName()); + Assert.assertTrue(d.getMetadata().getName().startsWith("test-deployment-fx-market-predictor-svc-orch")); Assert.assertEquals(1, d.getSpec().getReplicas()); Assert.assertEquals(1, d.getSpec().getTemplate().getSpec().getContainersCount()); d = argument.getAllValues().get(1); @@ -86,7 +86,7 @@ public void testRandomABTest() throws Exception verify(mockProtoClient,Mockito.times(3)).create(argument.capture(), any(String.class), any(String.class), Mockito.matches("Deployment")); Deployment d = argument.getAllValues().get(0); - Assert.assertEquals("test-deployment-abtest-abtest-svc-orch", d.getMetadata().getName()); + Assert.assertTrue(d.getMetadata().getName().startsWith("test-deployment-abtest-abtest-svc-orch")); Assert.assertEquals(1, d.getSpec().getReplicas()); Assert.assertEquals(1, d.getSpec().getTemplate().getSpec().getContainersCount()); @@ -142,7 +142,7 @@ public void testRandomABTest1Pod() throws Exception Deployment d = argument.getAllValues().get(0); System.out.println(d.getMetadata().getName()); - Assert.assertEquals("test-deployment-abtest-fx-market-predictor-svc-orch", d.getMetadata().getName()); + Assert.assertTrue(d.getMetadata().getName().startsWith("test-deployment-abtest-fx-market-predictor-svc-orch")); Assert.assertEquals(1, d.getSpec().getReplicas()); Assert.assertEquals(1, d.getSpec().getTemplate().getSpec().getContainersCount()); d = argument.getAllValues().get(1); diff --git a/testing/scripts/test_rolling_updates.py b/testing/scripts/test_rolling_updates.py index f117bac134..f0d2521fdd 100644 --- a/testing/scripts/test_rolling_updates.py +++ b/testing/scripts/test_rolling_updates.py @@ -149,9 +149,9 @@ def test_rolling_update5(self): def test_rolling_update6(self): run("kubectl delete sdep --all", shell=True) wait_for_shutdown("mymodel-mymodel-e2eb561") - wait_for_shutdown("mymodel-mymodel-svc-orch") + wait_for_shutdown("mymodel-mymodel-svc-orch-8e2a24b") run("kubectl apply -f ../resources/graph1svc.json", shell=True, check=True) - wait_for_rollout("mymodel-mymodel-svc-orch") + wait_for_rollout("mymodel-mymodel-svc-orch-8e2a24b") wait_for_rollout("mymodel-mymodel-e2eb561") r = initial_rest_request() assert r.status_code == 200 @@ -173,9 +173,9 @@ def test_rolling_update6(self): def test_rolling_update7(self): run("kubectl delete sdep --all", shell=True) wait_for_shutdown("mymodel-mymodel-e2eb561") - wait_for_shutdown("mymodel-mymodel-svc-orch") + wait_for_shutdown("mymodel-mymodel-svc-orch-8e2a24b") run("kubectl apply -f ../resources/graph1svc.json", shell=True, check=True) - wait_for_rollout("mymodel-mymodel-svc-orch") + wait_for_rollout("mymodel-mymodel-svc-orch-8e2a24b") wait_for_rollout("mymodel-mymodel-e2eb561") r = initial_rest_request() assert r.status_code == 200 @@ -197,9 +197,9 @@ def test_rolling_update7(self): def test_rolling_update8(self): run("kubectl delete sdep --all", shell=True) wait_for_shutdown("mymodel-mymodel-e2eb561") - wait_for_shutdown("mymodel-mymodel-svc-orch") + wait_for_shutdown("mymodel-mymodel-svc-orch-8e2a24b") run("kubectl apply -f ../resources/graph1svc.json", shell=True, check=True) - wait_for_rollout("mymodel-mymodel-svc-orch") + wait_for_rollout("mymodel-mymodel-svc-orch-8e2a24b") wait_for_rollout("mymodel-mymodel-e2eb561") r = initial_rest_request() assert r.status_code == 200 @@ -219,9 +219,9 @@ def test_rolling_update8(self): def test_rolling_update9(self): run("kubectl delete sdep --all", shell=True) wait_for_shutdown("mymodel-mymodel-e2eb561") - wait_for_shutdown("mymodel-mymodel-svc-orch") + wait_for_shutdown("mymodel-mymodel-svc-orch-8e2a24b") run("kubectl apply -f ../resources/graph1svc.json", shell=True, check=True) - wait_for_rollout("mymodel-mymodel-svc-orch") + wait_for_rollout("mymodel-mymodel-svc-orch-8e2a24b") wait_for_rollout("mymodel-mymodel-e2eb561") r = initial_rest_request() assert r.status_code == 200 @@ -243,9 +243,9 @@ def test_rolling_update9(self): def test_rolling_update10(self): run("kubectl delete sdep --all", shell=True) wait_for_shutdown("mymodel-mymodel-e2eb561") - wait_for_shutdown("mymodel-mymodel-svc-orch") + wait_for_shutdown("mymodel-mymodel-svc-orch-8e2a24b") run("kubectl apply -f ../resources/graph1svc.json", shell=True, check=True) - wait_for_rollout("mymodel-mymodel-svc-orch") + wait_for_rollout("mymodel-mymodel-svc-orch-8e2a24b") wait_for_rollout("mymodel-mymodel-e2eb561") r = initial_rest_request() assert r.status_code == 200