You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2021/12/13 18:48:29 UTC

[GitHub] [submarine] KUAN-HSUN-LI commented on a change in pull request #829: SUBMARINE-1130. New route to serve pod

KUAN-HSUN-LI commented on a change in pull request #829:
URL: https://github.com/apache/submarine/pull/829#discussion_r768027297



##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -522,16 +522,39 @@ public Notebook deleteNotebook(NotebookSpec spec) throws SubmarineRuntimeExcepti
   public void createServe(ServeSpec spec)
       throws SubmarineRuntimeException {
     SeldonDeployment seldonDeployment = parseServeSpec(spec);
-
+    IstioVirtualService istioVirtualService = new IstioVirtualService(spec.getModelName(),
+        spec.getModelVersion());
     try {
       api.createNamespacedCustomObject(seldonDeployment.getGroup(),
-              seldonDeployment.getVersion(),
+               seldonDeployment.getVersion(),
+               "default",
+               seldonDeployment.getPlural(),
+               seldonDeployment,
+               "true");
+    } catch (ApiException e) {
+      LOG.error(e.getMessage(), e);
+      throw new SubmarineRuntimeException(e.getCode(), e.getMessage());
+    }
+    try {
+      api.createNamespacedCustomObject(istioVirtualService.getGroup(),
+              istioVirtualService.getVersion(),
               "default",
-              seldonDeployment.getPlural(),
-              seldonDeployment,
+              istioVirtualService.getPlural(),
+              istioVirtualService,
               "true");
     } catch (ApiException e) {
       LOG.error(e.getMessage(), e);
+      try {
+        api.deleteNamespacedCustomObject(seldonDeployment.getGroup(),
+              seldonDeployment.getVersion(),
+              "default",
+              seldonDeployment.getPlural(),
+              seldonDeployment.getMetadata().getName(),
+              new V1DeleteOptionsBuilder().withApiVersion(seldonDeployment.getApiVersion()).build(),
+              null, null, null);
+      } catch (ApiException e1) {
+        LOG.error(e1.getMessage(), e1);
+      }

Review comment:
       Why do we need to delete the object when an error happens? Does it sometimes create the resource when an error happens?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org