From f84762188fc6ef3df6915ad0eef8e236fbc4d247 Mon Sep 17 00:00:00 2001 From: Clive Cox Date: Fri, 8 Feb 2019 11:03:06 +0000 Subject: [PATCH] Fix endpoint name --- .../src/main/java/io/seldon/apife/grpc/SeldonGrpcServer.java | 2 +- .../src/main/java/io/seldon/apife/k8s/KubernetesUtil.java | 5 +++++ .../main/java/io/seldon/apife/service/PredictionService.java | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api-frontend/src/main/java/io/seldon/apife/grpc/SeldonGrpcServer.java b/api-frontend/src/main/java/io/seldon/apife/grpc/SeldonGrpcServer.java index 8a0375ac9d..7205c67aa2 100644 --- a/api-frontend/src/main/java/io/seldon/apife/grpc/SeldonGrpcServer.java +++ b/api-frontend/src/main/java/io/seldon/apife/grpc/SeldonGrpcServer.java @@ -217,7 +217,7 @@ public void deploymentAdded(SeldonDeployment resource) { else { final String namespace = k8sUtil.getNamespace(resource); - final String endpoint = resource.getSpec().getName() + "." + namespace; + final String endpoint = k8sUtil.getSeldonId(resource) + "." + namespace; final ManagedChannel channel = ManagedChannelBuilder.forAddress(endpoint, appProperties.getEngineGrpcContainerPort()).usePlaintext(true).build(); if (appProperties.isSingleNamespace()) channelStore.put(resource.getSpec().getOauthKey(),channel); diff --git a/api-frontend/src/main/java/io/seldon/apife/k8s/KubernetesUtil.java b/api-frontend/src/main/java/io/seldon/apife/k8s/KubernetesUtil.java index 38acc5bf07..12ece9be30 100644 --- a/api-frontend/src/main/java/io/seldon/apife/k8s/KubernetesUtil.java +++ b/api-frontend/src/main/java/io/seldon/apife/k8s/KubernetesUtil.java @@ -13,5 +13,10 @@ public String getNamespace(SeldonDeployment d) else return d.getMetadata().getNamespace(); } + + public String getSeldonId(SeldonDeployment mlDep) + { + return mlDep.getSpec().getName() + "-" + mlDep.getMetadata().getName(); + } } diff --git a/api-frontend/src/main/java/io/seldon/apife/service/PredictionService.java b/api-frontend/src/main/java/io/seldon/apife/service/PredictionService.java index 469eef71de..ed6c998f8b 100644 --- a/api-frontend/src/main/java/io/seldon/apife/service/PredictionService.java +++ b/api-frontend/src/main/java/io/seldon/apife/service/PredictionService.java @@ -44,7 +44,7 @@ public String predict(String request,String clientId) { SeldonDeployment deployment = deploymentStore.getDeployment(clientId); if (deployment != null) { - final String endpoint = deployment.getSpec().getName() + "." + k8sUtil.getNamespace(deployment); + final String endpoint = k8sUtil.getSeldonId(deployment) + "." + k8sUtil.getNamespace(deployment); return internalPredictionService.getPrediction(request, endpoint); } else @@ -56,7 +56,7 @@ public void sendFeedback(String feedback, String deploymentId){ SeldonDeployment deployment = deploymentStore.getDeployment(deploymentId); if (deployment != null) { - final String endpoint = deployment.getSpec().getName() + "." + k8sUtil.getNamespace(deployment); + final String endpoint = k8sUtil.getSeldonId(deployment) + "." + k8sUtil.getNamespace(deployment); internalPredictionService.sendFeedback(feedback, endpoint); } else