You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2022/12/14 07:23:54 UTC

[submarine] branch master updated: SUBMARINE-1355. Remove seldon graph storage initializerimage dependence

This is an automated email from the ASF dual-hosted git repository.

pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new b3088cf5 SUBMARINE-1355. Remove seldon graph storage initializerimage dependence
b3088cf5 is described below

commit b3088cf560995676c96759ccc4a7ece54bb377bd
Author: cdmikechen <cd...@apache.org>
AuthorDate: Sat Dec 10 22:44:27 2022 +0800

    SUBMARINE-1355. Remove seldon graph storage initializerimage dependence
    
    ### What is this PR for?
    The installation of seldon-core by helm will specify the storageInitializer image and version by default, so we do not need to hard code this.
    
    ### What type of PR is it?
    Improvement
    
    ### Todos
    * [x] - Remove seldonio rclone-storage-initializer image hard code
    * [x] - Add serve test case to codecov
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-1355
    
    ### How should this be tested?
    NA
    
    ### Screenshots (if appropriate)
    NA
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: cdmikechen <cd...@apache.org>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #1023 from cdmikechen/SUBMARINE-1355 and squashes the following commits:
    
    a68345ae [cdmikechen] Try to add submarine-serve codecov
    e4cd3798 [cdmikechen] Fix sidecar istio cni error
    3fa00154 [cdmikechen] Remove seldonio rclone-storage-initializer image hard code
---
 .github/workflows/master.yml                       | 24 +++++++++++
 .../serve/seldon/PredictorAnnotations.java         | 21 +++++++++-
 .../apache/submarine/serve/seldon/SeldonGraph.java | 37 ++++++++++++-----
 .../submarine/serve/utils/SeldonConstants.java     |  2 -
 .../serve/seldon/SeldonDeploymentTest.java         | 47 ++++++++++++++++++++++
 5 files changed, 117 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 77609c30..68bbcd99 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -466,6 +466,12 @@ jobs:
           path: |
             ./submarine-server/server-core/target/jacoco.exec
           key: ${{ runner.os }}-docker-${{ github.sha }}
+      - name: Cache serve jacoco.exec
+        uses: actions/cache@v2
+        with:
+          path: |
+            ./submarine-serve/target/jacoco.exec
+          key: ${{ runner.os }}-docker-${{ github.sha }}
       - name: Set up JDK 1.8
         uses: actions/setup-java@v1
         with:
@@ -507,6 +513,18 @@ jobs:
         run: |
           echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
           mvn $TEST_FLAG $TEST_MODULES -B
+      - name: Build submarine-serve
+        env:
+          MODULES: "-pl :submarine-serve"
+        run: |
+          echo ">>> mvn $BUILD_FLAG $MODULES -B"
+          mvn $BUILD_FLAG $MODULES -B
+      - name: Test submarine-serve
+        env:
+          TEST_MODULES: "-pl :submarine-serve"
+        run: |
+          echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+          mvn $TEST_FLAG $TEST_MODULES -B
   submarine-workbench:
     runs-on: ubuntu-latest
     timeout-minutes: 30
@@ -712,6 +730,12 @@ jobs:
           path: |
             ./submarine-server/server-core/target/jacoco.exec
           key: ${{ runner.os }}-docker-${{ github.sha }}
+      - name: Cache submarine-serve data
+        uses: actions/cache@v2
+        with:
+          path: |
+            ./submarine-serve/target/jacoco.exec
+          key: ${{ runner.os }}-docker-${{ github.sha }}
       - name: Cache submarine-submitter data
         uses: actions/cache@v2
         with:
diff --git a/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/PredictorAnnotations.java b/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/PredictorAnnotations.java
index 472467fc..0f9fb3be 100644
--- a/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/PredictorAnnotations.java
+++ b/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/PredictorAnnotations.java
@@ -36,12 +36,21 @@ public class PredictorAnnotations {
   @JsonProperty("seldon.io/svc-name")
   private String serviceName;
 
+  /**
+   * To avoid the problem of the model initializer not being able to access S3(Minio) in the initcontainer
+   * due to the use of istio, a traffic `excludeOutboundPorts` has been added here.
+   * Reference link: Compatibility with application init containers,
+   * https://istio.io/latest/docs/setup/additional-setup/cni/#compatibility-with-application-init-containers
+   */
+  @SerializedName("traffic.sidecar.istio.io/excludeOutboundPorts")
+  @JsonProperty("traffic.sidecar.istio.io/excludeOutboundPorts")
+  private String excludeOutboundPorts = "9000";
+
   /**
    * Get predictor annotations with custom service name
    */
   public static PredictorAnnotations service(String serviceName) {
-    return new PredictorAnnotations()
-            .setServiceName(serviceName);
+    return new PredictorAnnotations().setServiceName(serviceName);
   }
 
   public String getServiceName() {
@@ -52,4 +61,12 @@ public class PredictorAnnotations {
     this.serviceName = serviceName;
     return this;
   }
+
+  public void setExcludeOutboundPorts(String excludeOutboundPorts) {
+    this.excludeOutboundPorts = excludeOutboundPorts;
+  }
+
+  public String getExcludeOutboundPorts() {
+    return excludeOutboundPorts;
+  }
 }
diff --git a/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/SeldonGraph.java b/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/SeldonGraph.java
index d38956b0..3c4ade30 100644
--- a/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/SeldonGraph.java
+++ b/submarine-serve/src/main/java/org/apache/submarine/serve/seldon/SeldonGraph.java
@@ -21,15 +21,40 @@ package org.apache.submarine.serve.seldon;
 import com.google.gson.annotations.SerializedName;
 import org.apache.submarine.serve.utils.SeldonConstants;
 
+/**
+ * Seldon graph
+ * <p>
+ * Define the graph of every predictor in `spec.predictors[*].graph`, for more we can see:
+ * <a href="https://docs.seldon.io/projects/seldon-core/en/latest/graph/inference-graph.html">
+ *   Inference Graph
+ * </a>
+ */
 public class SeldonGraph {
+
+  /**
+   * Graph name, we generally order by version, e.g.
+   * version-1, version-2, version-3 ...
+   */
   @SerializedName("name")
   private String name;
+
+  /**
+   * Graph implementation, can be:
+   * TENSORFLOW_SERVER, TRITON_SERVER or XGBOOST_SERVER
+   */
   @SerializedName("implementation")
   private String implementation;
+
+  /**
+   * Model storage path on S3(minio), e.g.
+   * s3://submarine/registry/${model_version_path}/${model_name}
+   */
   @SerializedName("modelUri")
   private String modelUri;
-  @SerializedName("storageInitializerImage")
-  private String storageInitializerImage = SeldonConstants.STORAGE_INITIALIZER_IMAGE;
+
+  /**
+   * S3(minio) secret, We have created `Secret` resource by default when creating the submarine
+   */
   @SerializedName("envSecretRefName")
   private String envSecretRefName = SeldonConstants.ENV_SECRET_REF_NAME;
 
@@ -60,14 +85,6 @@ public class SeldonGraph {
     this.modelUri = modelUri;
   }
 
-  public String getStorageInitializerImage() {
-    return storageInitializerImage;
-  }
-
-  public void setStorageInitializerImage(String storageInitializerImage) {
-    this.storageInitializerImage = storageInitializerImage;
-  }
-
   public String getEnvSecretRefName() {
     return envSecretRefName;
   }
diff --git a/submarine-serve/src/main/java/org/apache/submarine/serve/utils/SeldonConstants.java b/submarine-serve/src/main/java/org/apache/submarine/serve/utils/SeldonConstants.java
index e54d621a..ddc9771c 100644
--- a/submarine-serve/src/main/java/org/apache/submarine/serve/utils/SeldonConstants.java
+++ b/submarine-serve/src/main/java/org/apache/submarine/serve/utils/SeldonConstants.java
@@ -29,8 +29,6 @@ public class SeldonConstants {
 
   public static final String PLURAL = "seldondeployments";
 
-  public static final String STORAGE_INITIALIZER_IMAGE = "seldonio/rclone-storage-initializer:1.10.0";
-
   public static final String ENV_SECRET_REF_NAME = "submarine-serve-secret";
 
   public static final String SELDON_PROTOCOL = "seldon";
diff --git a/submarine-serve/src/test/java/org/apache/submarine/serve/seldon/SeldonDeploymentTest.java b/submarine-serve/src/test/java/org/apache/submarine/serve/seldon/SeldonDeploymentTest.java
new file mode 100644
index 00000000..61a2370e
--- /dev/null
+++ b/submarine-serve/src/test/java/org/apache/submarine/serve/seldon/SeldonDeploymentTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.submarine.serve.seldon;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SeldonDeploymentTest {
+
+  private static final Gson gson = new Gson();
+
+  @Test
+  public void testPredictorAnnotations() {
+    PredictorAnnotations annotations = PredictorAnnotations
+            .service("submarine-model-1-c9d95a3881b941148b0e2a6362605c00");
+    JsonObject json = gson.toJsonTree(annotations).getAsJsonObject();
+    Assert.assertEquals(json.size(), 2);
+    Assert.assertEquals(
+            json.get("seldon.io/svc-name").getAsString(),
+            "submarine-model-1-c9d95a3881b941148b0e2a6362605c00"
+    );
+    Assert.assertEquals(
+            json.get("traffic.sidecar.istio.io/excludeOutboundPorts").getAsString(),
+            "9000"
+    );
+  }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org