Skip to content

Commit

Permalink
Merge branch 'master' into release-0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox committed Dec 16, 2018
2 parents ec16b42 + 175fdd2 commit fca2cfd
Show file tree
Hide file tree
Showing 437 changed files with 32,560 additions and 8,220 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,28 @@ engine/src/main/resources/static/seldon.json
api-frontend/src/main/resources/static/seldon.json
wrappers/python/seldon.json

testing/notebooks/my-ml-deployment/
testing/notebooks/my-model/
testing/notebooks/proto/prediction.proto
testing/notebooks/tensorflow/
api-frontend/pom.xml.versionsBackup
api-frontend/src/main/proto/tensorflow/
cluster-manager/pom.xml.versionsBackup
engine/pom.xml.versionsBackup
engine/src/main/proto/tensorflow/

seldon-core/seldon-core/json/template_0.2.yaml
seldon-core/seldon-core/json/template_0.2_cluster_wide.yaml
seldon-core/seldon-core/json/template_0.2_single_namespace.yaml
openapi/prediction.grpcapi.proto
openapi/prediction.grpcapi.swagger.json
openapi/tensorflow/
proto/tensorflow/tensorflow/

util/loadtester/MNIST_data/

# python build
eggs/
.eggs/
*.egg-info/
./pytest_cache
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# Change Log

## [v0.2.4](https://github.com/SeldonIO/seldon-core/tree/v0.2.4) (2018-11-07)
[Full Changelog](https://github.com/SeldonIO/seldon-core/compare/v0.2.3...v0.2.4)

**Closed issues:**

- Specification of a Service Account [\#286](https://github.com/SeldonIO/seldon-core/issues/286)
- curl not found error [\#283](https://github.com/SeldonIO/seldon-core/issues/283)
- Allow ambassador from other namespace to access SeldonDeployment [\#279](https://github.com/SeldonIO/seldon-core/issues/279)
- Fix Github security vulnerabilities in dependencies [\#259](https://github.com/SeldonIO/seldon-core/issues/259)
- Feedback API not called when using Models [\#251](https://github.com/SeldonIO/seldon-core/issues/251)
- Allow JAVA OPTS for engine to be specified [\#249](https://github.com/SeldonIO/seldon-core/issues/249)
- ndarray greater than 15280 bytes [\#248](https://github.com/SeldonIO/seldon-core/issues/248)
- Prediction API get model version [\#244](https://github.com/SeldonIO/seldon-core/issues/244)
- SeldonDeployment creation strips out an empty "children" list field in the manifest [\#242](https://github.com/SeldonIO/seldon-core/issues/242)
- Mahalanobis Outlier Detector fails when batch is of size 1 [\#240](https://github.com/SeldonIO/seldon-core/issues/240)
- Seldon Core Operator defaulting causes issues with helm and ArgoCD [\#233](https://github.com/SeldonIO/seldon-core/issues/233)
- TensorFlow Serving as the Model microservice [\#226](https://github.com/SeldonIO/seldon-core/issues/226)
- Nodejs wrapper for javascript models [\#216](https://github.com/SeldonIO/seldon-core/issues/216)
- Environmental variable error [\#215](https://github.com/SeldonIO/seldon-core/issues/215)
- How do I increase timeout of sidecar seldon container? [\#196](https://github.com/SeldonIO/seldon-core/issues/196)
- update release script for pyhton3 [\#160](https://github.com/SeldonIO/seldon-core/issues/160)
- Ability to customize Ambassador configuration [\#120](https://github.com/SeldonIO/seldon-core/issues/120)
- Script to convert proto files and generate OpenAPI schema [\#9](https://github.com/SeldonIO/seldon-core/issues/9)
- OpenAPI spec for external and internal prediction APIs [\#6](https://github.com/SeldonIO/seldon-core/issues/6)

**Merged pull requests:**

- Add optional service account for engine [\#287](https://github.com/SeldonIO/seldon-core/pull/287) ([cliveseldon](https://github.com/cliveseldon))
- Add missing curl to engine Dockerfile [\#285](https://github.com/SeldonIO/seldon-core/pull/285) ([cliveseldon](https://github.com/cliveseldon))
- Allow ambassador from other namespace to access SeldonDeployment [\#280](https://github.com/SeldonIO/seldon-core/pull/280) ([ChenyuanZ](https://github.com/ChenyuanZ))
- Faster protobuffer to numpy conversion in python wrapper [\#278](https://github.com/SeldonIO/seldon-core/pull/278) ([cliveseldon](https://github.com/cliveseldon))
- Ensure cluster role has unique name [\#276](https://github.com/SeldonIO/seldon-core/pull/276) ([cliveseldon](https://github.com/cliveseldon))
- fix api-tester not using oauth-key and oauth-secret args [\#275](https://github.com/SeldonIO/seldon-core/pull/275) ([gsunner](https://github.com/gsunner))
- Update when status is set [\#273](https://github.com/SeldonIO/seldon-core/pull/273) ([cliveseldon](https://github.com/cliveseldon))
- Add OUTPUT\_TRANSFORMER example [\#272](https://github.com/SeldonIO/seldon-core/pull/272) ([ChenyuanZ](https://github.com/ChenyuanZ))
- Add Open API Definitions [\#271](https://github.com/SeldonIO/seldon-core/pull/271) ([cliveseldon](https://github.com/cliveseldon))
- Update Custom Resources via k8s /status endpoint if possible [\#270](https://github.com/SeldonIO/seldon-core/pull/270) ([cliveseldon](https://github.com/cliveseldon))
- Fixed small copy-paste error [\#266](https://github.com/SeldonIO/seldon-core/pull/266) ([lorello](https://github.com/lorello))
- Update ambassador to 0.40.0 [\#265](https://github.com/SeldonIO/seldon-core/pull/265) ([cliveseldon](https://github.com/cliveseldon))
- Add code coverage Jacoco to poms [\#264](https://github.com/SeldonIO/seldon-core/pull/264) ([cliveseldon](https://github.com/cliveseldon))
- Fix vulnerability warnings with updates to engine and apife pom [\#263](https://github.com/SeldonIO/seldon-core/pull/263) ([cliveseldon](https://github.com/cliveseldon))
- Add custom metrics proposal [\#261](https://github.com/SeldonIO/seldon-core/pull/261) ([cliveseldon](https://github.com/cliveseldon))
- Intel Openvino Integration [\#260](https://github.com/SeldonIO/seldon-core/pull/260) ([cliveseldon](https://github.com/cliveseldon))
- Python wrapper custom endpoints [\#257](https://github.com/SeldonIO/seldon-core/pull/257) ([gsunner](https://github.com/gsunner))
- Sending Feedback to Models [\#254](https://github.com/SeldonIO/seldon-core/pull/254) ([cliveseldon](https://github.com/cliveseldon))
- Python wrapper custom endpoints [\#252](https://github.com/SeldonIO/seldon-core/pull/252) ([gsunner](https://github.com/gsunner))
- Engine java opts annotations and ambassador timeout annotation [\#250](https://github.com/SeldonIO/seldon-core/pull/250) ([cliveseldon](https://github.com/cliveseldon))
- Update Ksonnet and Helm Charts [\#247](https://github.com/SeldonIO/seldon-core/pull/247) ([cliveseldon](https://github.com/cliveseldon))
- Add requestPath to response meta data [\#246](https://github.com/SeldonIO/seldon-core/pull/246) ([cliveseldon](https://github.com/cliveseldon))
- Fix outlier detection divide by zero and add initial mnist example \(wip\) [\#243](https://github.com/SeldonIO/seldon-core/pull/243) ([cliveseldon](https://github.com/cliveseldon))
- Fix typos in docs [\#241](https://github.com/SeldonIO/seldon-core/pull/241) ([jklaise](https://github.com/jklaise))
- Add example helm charts for inference graphs [\#239](https://github.com/SeldonIO/seldon-core/pull/239) ([cliveseldon](https://github.com/cliveseldon))
- Fix for defaulting changing Custom Resource [\#238](https://github.com/SeldonIO/seldon-core/pull/238) ([cliveseldon](https://github.com/cliveseldon))
- Image pull policy ksonnet fix [\#235](https://github.com/SeldonIO/seldon-core/pull/235) ([gsunner](https://github.com/gsunner))
- Nvidia Inference Server and Tensorflow Serving Model Proxies [\#234](https://github.com/SeldonIO/seldon-core/pull/234) ([cliveseldon](https://github.com/cliveseldon))
- Update kubectl\_demo\_minikube\_rbac.ipynb [\#232](https://github.com/SeldonIO/seldon-core/pull/232) ([benoitbayol](https://github.com/benoitbayol))
- Update epsilon-greedy example to Python 3 [\#231](https://github.com/SeldonIO/seldon-core/pull/231) ([jklaise](https://github.com/jklaise))
- Update kubectl\_demo\_minikube\_rbac.ipynb [\#230](https://github.com/SeldonIO/seldon-core/pull/230) ([benoitbayol](https://github.com/benoitbayol))
- GRPC API for javascript models with Nodejs s2i wrapper [\#224](https://github.com/SeldonIO/seldon-core/pull/224) ([SachinVarghese](https://github.com/SachinVarghese))

## [v0.2.3](https://github.com/SeldonIO/seldon-core/tree/v0.2.3) (2018-09-17)
[Full Changelog](https://github.com/SeldonIO/seldon-core/compare/v0.2.2...v0.2.3)

Expand Down
2 changes: 1 addition & 1 deletion api-frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:8u171-jre-alpine3.7
FROM openjdk:8u181-jre-alpine3.8

ARG APP_VERSION=UNKOWN_VERSION

Expand Down
1 change: 1 addition & 0 deletions api-frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ update_proto:
cp -v ../proto/prediction.proto src/main/proto/
cp -vr ../proto/k8s/k8s.io src/main/proto
cp -v ../proto/k8s/v1.proto src/main/proto
cp -vr ../proto/tensorflow/tensorflow src/main/proto

port_forward_api_server:
POD_NAME=$$(kubectl --namespace default get pod -l app=seldon-apiserver-container-app -o template --template="{{(index .items 0).metadata.name}}") && \
Expand Down
10 changes: 7 additions & 3 deletions api-frontend/Makefile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ clean:
rm -fvr src/main/proto/k8s.io
rm -fv src/main/proto/v1.proto

download_protos:
download_protos_k8s:
cd ../proto/k8s ; make create_protos

update_proto: download_protos
download_protos_tensorflow:
cd ../proto/tensorflow ; make create_protos

update_proto: download_protos_k8s download_protos_tensorflow
cp -v ../proto/seldon_deployment.proto src/main/proto/
cp -v ../proto/prediction.proto src/main/proto/
cp -vr ../proto/k8s/k8s.io src/main/proto
cp -v ../proto/k8s/v1.proto src/main/proto

cp -vr ../proto/tensorflow/tensorflow src/main/proto

update_swagger:
cp -v ../openapi/apife.oas3.json src/main/resources/static/seldon.json
34 changes: 33 additions & 1 deletion api-frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>io.seldon.apife</groupId>
<artifactId>seldon-apife</artifactId>
<version>0.2.4</version>
<version>0.2.5</version>
<packaging>jar</packaging>

<name>api-frontend</name>
Expand Down Expand Up @@ -39,6 +39,14 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<configuration>
<excludes>
<exclude>**/generated-sources/**/*.class</exclude>
<exclude>**/io/kubernetes/**/*.class</exclude>
<exclude>**/io/seldon/protos/**/*.class</exclude>
<exclude>**/org/tensorflow/framework/**/*.class</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
Expand Down Expand Up @@ -154,6 +162,30 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion api-frontend/src/main/java/io/seldon/apife/AppProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AppProperties {
private int engineContainerPort;
private int engineGrpcContainerPort;
private String namespace;
private boolean singleNamespace = true;

public int getEngineContainerPort() {
return engineContainerPort;
Expand All @@ -43,7 +44,14 @@ public String getNamespace() {
public void setNamespace(String namespace) {
this.namespace = namespace;
}
@Override

public boolean isSingleNamespace() {
return singleNamespace;
}
public void setSingleNamespace(boolean singleNamespace) {
this.singleNamespace = singleNamespace;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@

import javax.annotation.PostConstruct;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import io.seldon.apife.AppProperties;
import io.seldon.apife.api.oauth.InMemoryClientDetailsService;
import io.seldon.apife.k8s.KubernetesUtil;
import io.seldon.protos.DeploymentProtos.DeploymentSpec;
import io.seldon.protos.DeploymentProtos.SeldonDeployment;

Expand All @@ -34,17 +37,19 @@ public class DeploymentStore implements DeploymentsListener {
protected static Logger logger = LoggerFactory.getLogger(DeploymentStore.class.getName());

//Oauth key to deployment def
private ConcurrentMap<String, DeploymentSpec> deploymentStore = new ConcurrentHashMap<>();
private ConcurrentMap<String, SeldonDeployment> deploymentStore = new ConcurrentHashMap<>();

private final DeploymentsHandler deploymentsHandler;

private InMemoryClientDetailsService clientDetailsService;
private final InMemoryClientDetailsService clientDetailsService;
private final AppProperties appProperties;
private final KubernetesUtil k8sUtil = new KubernetesUtil();

@Autowired
public DeploymentStore(DeploymentsHandler deploymentsHandler,InMemoryClientDetailsService clientDetailsService)
public DeploymentStore(DeploymentsHandler deploymentsHandler,InMemoryClientDetailsService clientDetailsService,AppProperties appProperties)
{
this.deploymentsHandler = deploymentsHandler;
this.clientDetailsService = clientDetailsService;
this.appProperties = appProperties;
}

@PostConstruct
Expand All @@ -53,20 +58,35 @@ private void init() throws Exception{
deploymentsHandler.addListener(this);
}

public DeploymentSpec getDeployment(String clientId)
{
return deploymentStore.get(clientId);
}


public SeldonDeployment getDeployment(String clientId)
{
return deploymentStore.get(clientId);
}

@Override
public void deploymentAdded(SeldonDeployment mlDep) {
final DeploymentSpec deploymentDef = mlDep.getSpec();
final String namespace = k8sUtil.getNamespace(mlDep);

deploymentStore.put(deploymentDef.getOauthKey(), deploymentDef);
clientDetailsService.addClient(deploymentDef.getOauthKey(), deploymentDef.getOauthSecret());
if (StringUtils.isEmpty(deploymentDef.getOauthKey()))
{
logger.warn("Deployment with empty oauth key - ignoring {}",deploymentDef.getName());
}
else
{
if (appProperties.isSingleNamespace())
{
deploymentStore.put(deploymentDef.getOauthKey(), mlDep);
clientDetailsService.addClient(deploymentDef.getOauthKey(), deploymentDef.getOauthSecret());
}

// Always add namespaced key
final String namespacedKey = deploymentDef.getOauthKey() + namespace;
deploymentStore.put(namespacedKey, mlDep);
clientDetailsService.addClient(namespacedKey, deploymentDef.getOauthSecret());

logger.info("Succesfully added or updated deployment "+deploymentDef.getName());
logger.info("Succesfully added or updated deployment "+deploymentDef.getName());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import javax.annotation.PostConstruct;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -34,13 +35,11 @@
import io.grpc.ServerInterceptors;
import io.grpc.netty.NettyServerBuilder;
import io.seldon.apife.AppProperties;
import io.seldon.apife.api.oauth.InMemoryClientDetailsService;
import io.seldon.apife.config.AnnotationsConfig;
import io.seldon.apife.deployments.DeploymentStore;
import io.seldon.apife.deployments.DeploymentsHandler;
import io.seldon.apife.exception.SeldonAPIException;
import io.seldon.apife.k8s.DeploymentWatcher;
import io.seldon.protos.DeploymentProtos.DeploymentSpec;
import io.seldon.apife.k8s.KubernetesUtil;
import io.seldon.protos.DeploymentProtos.SeldonDeployment;

@Component
Expand All @@ -66,6 +65,7 @@ public class SeldonGrpcServer {
public static final int TIMEOUT = 5;
private int maxMessageSize = io.grpc.internal.GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE;
private int grpcReadTimeout = DEFAULT_GRPC_READ_TIMEOUT;
private final KubernetesUtil k8sUtil = new KubernetesUtil();

@Autowired
public SeldonGrpcServer(AppProperties appProperties,DeploymentStore deploymentStore,TokenStore tokenStore,DeploymentsHandler deploymentsHandler,AnnotationsConfig annotations)
Expand Down Expand Up @@ -154,8 +154,8 @@ public ManagedChannel getChannel() {
throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_GRPC_NO_PRINCIPAL_FOUND,"");
}

final DeploymentSpec deploymentSpec = deploymentStore.getDeployment(principal);
if (deploymentSpec == null)
final SeldonDeployment mlDep = deploymentStore.getDeployment(principal);
if (mlDep == null)
{
throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_NO_RUNNING_DEPLOYMENT,"Principal is "+principal);
}
Expand Down Expand Up @@ -209,30 +209,21 @@ private void blockUntilShutdown() throws InterruptedException {
}
}

/**
* Main method for basic testing.
*/
public static void main(String[] args) throws Exception {
DeploymentStore store = new DeploymentStore(null,new InMemoryClientDetailsService());
SeldonDeployment dep = SeldonDeployment.newBuilder()
.setApiVersion(DeploymentWatcher.VERSION)
.setKind("SeldonDeplyment")
.setSpec(DeploymentSpec.newBuilder()
.setName("0.0.0.0")
.setOauthKey("key")
.setOauthSecret("secret")
).build();
AppProperties appProperties = new AppProperties();
appProperties.setEngineGrpcContainerPort(5000);
store.deploymentAdded(dep);
SeldonGrpcServer server = new SeldonGrpcServer(appProperties,store,null,null,null,SERVER_PORT);
server.start();
server.blockUntilShutdown();
}

public void deploymentAdded(SeldonDeployment resource) {
ManagedChannel channel = ManagedChannelBuilder.forAddress(resource.getSpec().getName(), appProperties.getEngineGrpcContainerPort()).usePlaintext(true).build();
channelStore.put(resource.getSpec().getOauthKey(),channel);
if (StringUtils.isEmpty(resource.getSpec().getOauthKey()))
{
logger.warn("Empty oauth key ignoring for {}",resource.getSpec().getName());
}
else
{
final String namespace = k8sUtil.getNamespace(resource);
final String endpoint = resource.getSpec().getName() + "." + namespace;
final ManagedChannel channel = ManagedChannelBuilder.forAddress(endpoint, appProperties.getEngineGrpcContainerPort()).usePlaintext(true).build();
if (appProperties.isSingleNamespace())
channelStore.put(resource.getSpec().getOauthKey(),channel);
final String namespacedKey = resource.getSpec().getOauthKey() + namespace;
channelStore.put(namespacedKey,channel);
}
}

public void deploymentRemoved(SeldonDeployment resource) {
Expand Down
Loading

0 comments on commit fca2cfd

Please sign in to comment.