Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/apache/submarine into SUB…
Browse files Browse the repository at this point in the history
…MARINE-1139
  • Loading branch information
FatalLin committed Dec 21, 2021
2 parents f814549 + a1436e3 commit 8f3e458
Show file tree
Hide file tree
Showing 43 changed files with 1,070 additions and 215 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<!--library versions-->
<tony.version>0.4.7</tony.version>
<jersey.version>2.27</jersey.version>
<jersey.version>2.35</jersey.version>
<jersey.servlet.version>1.13</jersey.servlet.version>
<jetty.version>9.4.35.v20201120</jetty.version>
<javax.ws.rsapi.version>2.1</javax.ws.rsapi.version>
Expand Down Expand Up @@ -127,10 +127,10 @@
<mybatis-generator.version>1.3.7</mybatis-generator.version>
<derby.version>10.15.1.3</derby.version>
<zeppelin.version>0.9.0-preview1</zeppelin.version>
<jgit.version>5.5.1.201910021850-r</jgit.version>
<jgit.version>5.13.0.202109080827-r</jgit.version>
<atomix.version>3.1.5</atomix.version>
<!-- Submarine on Kubernetes -->
<k8s.client-java.version>6.0.1</k8s.client-java.version>
<k8s.client-java.version>11.0.1</k8s.client-java.version>
<jersey.test-framework>2.27</jersey.test-framework>
<!-- integration test-->
<plugin.failsafe.version>2.17</plugin.failsafe.version>
Expand Down
13 changes: 13 additions & 0 deletions submarine-cloud-v2/artifacts/submarine/submarine-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ rules:
- deletecollection
- patch
- update
- apiGroups:
- networking.istio.io
resources:
- virtualservices
verbs:
- get
- list
- watch
- create
- delete
- deletecollection
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public enum ConfVars {
"org.apache.submarine.server.submitter.yarn.YarnRuntimeFactory"),
SUBMARINE_SUBMITTER("submarine.submitter", "k8s"),
ENVIRONMENT_CONDA_MIN_VERSION("environment.conda.min.version", "4.0.1"),
ENVIRONMENT_CONDA_MAX_VERSION("environment.conda.max.version", "4.10.10");
ENVIRONMENT_CONDA_MAX_VERSION("environment.conda.max.version", "4.11.10");

private String varName;
@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.istio;

import com.google.gson.annotations.SerializedName;
import org.apache.submarine.serve.utils.IstioConstants;

public class IstioHTTPDestination {
@SerializedName("destination")
private IstioDestination destination;

public IstioHTTPDestination(String host){
this.destination = new IstioDestination(host);
}


public static class IstioDestination{
@SerializedName("host")
private String host;

@SerializedName("port")
private IstioPort port;

public IstioDestination(String host) {
this.host = host;
this.port = new IstioPort(IstioConstants.DEFAULT_SERVE_POD_PORT);
}
}

public static class IstioPort {
@SerializedName("number")
private Integer number;

public IstioPort(Integer port){
this.number = port;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.istio;

import com.google.gson.annotations.SerializedName;

public class IstioHTTPMatchRequest {
@SerializedName("uri")
private IstioPrefix prefix;

public IstioHTTPMatchRequest(String prefix) {
this.prefix = new IstioPrefix(prefix);
}

public static class IstioPrefix {
@SerializedName("prefix")
private String path;

public IstioPrefix(String path){
this.path = path;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.istio;

import com.google.gson.annotations.SerializedName;
import org.apache.submarine.serve.utils.IstioConstants;

import java.util.ArrayList;
import java.util.List;

public class IstioHTTPRoute {
@SerializedName("match")
private List<IstioHTTPMatchRequest> match = new ArrayList<>();

@SerializedName("route")
private List<IstioHTTPDestination> route = new ArrayList<>();

@SerializedName("rewrite")
private IstioRewrite rewrite;

public IstioHTTPRoute() {
this.rewrite = new IstioRewrite(IstioConstants.REWRITE_URL);
}

@Override
public String toString() {
return "'rewrite': {'uri': " + rewrite.getRewrite() + "}";

}

public void addHTTPMatchRequest(IstioHTTPMatchRequest match){
this.match.add(match);
}

public void addHTTPDestination(IstioHTTPDestination destination){
this.route.add(destination);
}
public static class IstioRewrite{
@SerializedName("uri")
private String uri;

public IstioRewrite(String rewrite){
this.uri = rewrite;
}

public String getRewrite() {
return uri;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* 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.istio;

import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import org.apache.submarine.serve.utils.IstioConstants;

import java.util.ArrayList;
import java.util.List;

public class IstioVirtualService {
@SerializedName("apiVersion")
private String apiVersion = IstioConstants.API_VERSION;

@SerializedName("kind")
private String kind = IstioConstants.KIND;

@SerializedName("metadata")
private V1ObjectMeta metadata;

@SerializedName("spec")
private IstioVirtualServiceSpec spec;

// transient to avoid being serialized
private transient String group = IstioConstants.GROUP;

private transient String version = IstioConstants.VERSION;

private transient String plural = IstioConstants.PLURAL;

public IstioVirtualService(String modelName, Integer modelVersion) {
V1ObjectMeta metadata = new V1ObjectMeta();
metadata.setName(modelName);
metadata.setNamespace(IstioConstants.DEFAULT_NAMESPACE);
setMetadata(metadata);
setSpec(new IstioVirtualServiceSpec(modelName, modelVersion));
}

public String getApiVersion() {
return apiVersion;
}

public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}

public String getKind() {
return kind;
}

public void setKind(String kind) {
this.kind = kind;
}

public V1ObjectMeta getMetadata() {
return metadata;
}

public void setMetadata(V1ObjectMeta metadata) {
this.metadata = metadata;
}

public String getGroup() {
return group;
}

public void setGroup(String group) {
this.group = group;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public String getPlural() {
return plural;
}

public void setPlural(String plural) {
this.plural = plural;
}

public IstioVirtualServiceSpec getSpec() {
return spec;
}

public void setSpec(IstioVirtualServiceSpec istioVirtualServiceSpec){
this.spec = istioVirtualServiceSpec;
}

public static class IstioVirtualServiceSpec {
@SerializedName("hosts")
private List<String> hosts = new ArrayList<>();
@SerializedName("gateways")
private List<String> gateways = new ArrayList<>();
@SerializedName("http")
private List<IstioHTTPRoute> httpRoute = new ArrayList<>();

public IstioVirtualServiceSpec(String modelName, Integer modelVersion) {
hosts.add(IstioConstants.DEFAULT_INGRESS_HOST);
gateways.add(IstioConstants.DEFAULT_GATEWAY);
IstioHTTPDestination destination = new IstioHTTPDestination(
modelName + "-" + IstioConstants.DEFAULT_NAMESPACE);
IstioHTTPMatchRequest matchRequest = new IstioHTTPMatchRequest("/" + modelName
+ "/" + String.valueOf(modelVersion) + "/");
IstioHTTPRoute httpRoute = new IstioHTTPRoute();
httpRoute.addHTTPDestination(destination);
httpRoute.addHTTPMatchRequest(matchRequest);
setHTTPRoute(httpRoute);
}

public List<String> getHosts() {
return this.hosts;
}

public void addHost(String host) {
hosts.add(host);
}

public List<String> getGateways() {
return this.gateways;
}

public void addGateway(String gateway) {
gateways.add(gateway);
}

public void setHTTPRoute(IstioHTTPRoute istioHTTPRoute){
this.httpRoute.add(istioHTTPRoute);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.submarine.serve.pytorch;

import io.kubernetes.client.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import org.apache.submarine.serve.seldon.SeldonDeployment;
import org.apache.submarine.serve.seldon.SeldonGraph;
import org.apache.submarine.serve.seldon.SeldonPredictor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.submarine.serve.seldon;

import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import org.apache.submarine.serve.utils.SeldonConstants;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.submarine.serve.tensorflow;

import io.kubernetes.client.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import org.apache.submarine.serve.seldon.SeldonDeployment;
import org.apache.submarine.serve.seldon.SeldonGraph;
import org.apache.submarine.serve.seldon.SeldonPredictor;
Expand Down
Loading

0 comments on commit 8f3e458

Please sign in to comment.