Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Orchestrator Name Fix #516

Merged
merged 3 commits into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions testing/scripts/test_rolling_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down