Skip to content

Commit

Permalink
further ksonnet integration - factored out the raw json
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox committed Jan 31, 2018
1 parent 9274d47 commit 72f900a
Show file tree
Hide file tree
Showing 12 changed files with 727 additions and 589 deletions.
597 changes: 60 additions & 537 deletions ksonnet/registry/seldon-core/core.libsonnet

Large diffs are not rendered by default.

254 changes: 254 additions & 0 deletions ksonnet/registry/seldon-core/crd.libsonnet

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions ksonnet/registry/seldon-core/json/apife-deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"apiVersion": "extensions/v1beta1",
"kind": "Deployment",
"metadata": {
"name": "seldon-apiserver"
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"annotations": {
"prometheus.io/path": "/prometheus",
"prometheus.io/port": "8080",
"prometheus.io/scrape": "true"
},
"labels": {
"app": "seldon-apiserver-container-app",
"version": "1"
}
},
"spec": {
"containers": [
{
"env": [
{
"name": "SELDON_ENGINE_KAFKA_SERVER",
"value": "kafka:9092"
},
{
"name": "SELDON_CLUSTER_MANAGER_REDIS_HOST",
"value": "redis"
}
],
"image": "seldonio/apife:{{ .Values.apife.image.tag }}",
"imagePullPolicy": "{{ .Values.apife.image.pull_policy }}",
"name": "seldon-apiserver-container",
"ports": [
{
"containerPort": 8080,
"protocol": "TCP"
},
{
"containerPort": 5000,
"protocol": "TCP"
}
]
}
]
}
}
}
}
36 changes: 36 additions & 0 deletions ksonnet/registry/seldon-core/json/apife-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"labels": {
"app": "seldon-apiserver-container-app"
},
"name": "seldon-apiserver"
},
"spec": {
"ports": [
{
"name": "http",
"nodePort": 30032,
"port": 8080,
"protocol": "TCP",
"targetPort": 8080
},
{
"name": "grpc",
"nodePort": 30033,
"port": 5000,
"protocol": "TCP",
"targetPort": 5000
}
],
"selector": {
"app": "seldon-apiserver-container-app"
},
"sessionAffinity": "None",
"type": "{{ .Values.apife_service_type }}"
},
"status": {
"loadBalancer": {}
}
}
73 changes: 73 additions & 0 deletions ksonnet/registry/seldon-core/json/operator-deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"kind": "Deployment",
"apiVersion": "apps/v1beta1",
"metadata": {
"name": "seldon-cluster-manager",
"creationTimestamp": null,
"labels": {
"app": "seldon-cluster-manager-server"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "seldon-cluster-manager-server"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "seldon-cluster-manager-server"
}
},
"spec": {
"containers": [
{
"name": "seldon-cluster-manager-container",
"image": "seldonio/cluster-manager:1234",
"ports": [
{
"containerPort": 8080,
"protocol": "TCP"
}
],
"env": [
{
"name": "SELDON_CLUSTER_MANAGER_REDIS_HOST",
"value": "redis"
},
{
"name": "SELDON_CLUSTER_MANAGER_POD_NAMESPACE",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
}
],
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"schedulerName": "default-scheduler"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": 1,
"maxSurge": 1
}
}
},
"status": {}
}
20 changes: 20 additions & 0 deletions ksonnet/registry/seldon-core/json/rbac-cluster-binding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "ClusterRoleBinding",
"metadata": {
"creationTimestamp": null,
"name": "seldon"
},
"roleRef": {
"apiGroup": "rbac.authorization.k8s.io",
"kind": "ClusterRole",
"name": "cluster-admin"
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "seldon",
"namespace": "default"
}
]
}
10 changes: 10 additions & 0 deletions ksonnet/registry/seldon-core/json/rbac-service-account.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"creationTimestamp": null,
"name": "seldon",
"namespace": "default"
}
}

59 changes: 59 additions & 0 deletions ksonnet/registry/seldon-core/json/redis-deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"apiVersion": "apps/v1beta1",
"kind": "Deployment",
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "redis-app"
},
"name": "redis"
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "redis-app"
}
},
"strategy": {
"rollingUpdate": {
"maxSurge": 1,
"maxUnavailable": 1
},
"type": "RollingUpdate"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "redis-app"
}
},
"spec": {
"containers": [
{
"image": "redis:4.0.1",
"imagePullPolicy": "IfNotPresent",
"name": "redis-container",
"ports": [
{
"containerPort": 6379,
"protocol": "TCP"
}
],
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File"
}
],
"dnsPolicy": "ClusterFirst",
"restartPolicy": "Always",
"schedulerName": "default-scheduler",
"securityContext": {},
"terminationGracePeriodSeconds": 30
}
}
},
"status": {}
}

25 changes: 25 additions & 0 deletions ksonnet/registry/seldon-core/json/redis-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"creationTimestamp": null,
"name": "redis"
},
"spec": {
"ports": [
{
"port": 6379,
"protocol": "TCP",
"targetPort": 6379
}
],
"selector": {
"app": "redis-app"
},
"sessionAffinity": "None",
"type": "ClusterIP"
},
"status": {
"loadBalancer": {}
}
}
73 changes: 37 additions & 36 deletions ksonnet/registry/seldon-core/prototypes/core.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
// @shortDescription Seldon Core components.
// @param name string Name seldon-core to give seldon-core
// @optionalParam namespace string default Namespace
// @optionalParam apifeImage string seldonio/apife:0.1.4-SNAPSHOT Default image for API Front End
// @optionalParam serviceType string LoadBalancer API Front End Service Type
// @optionalParam engineImage string seldonio/engine:0.1.4-SNAPSHOT Seldon engine image version
// @optionalParam clusterManagerImage string seldonio/cluster-manager:0.1.4-SNAPSHOT Seldon cluster manager image version
// @optionalParam springOpts string null cluster manager spring opts
// @optionalParam javaOpts string null cluster manager java opts
// @optionalParam withRbac string false Whether to include RBAC setup
// @optionalParam withApife string true Whether to include builtin API Oauth fornt end server for ingress
// @optionalParam apifeImage string seldonio/apife:0.1.4-SNAPSHOT Default image for API Front End
// @optionalParam apifeServiceType string LoadBalancer API Front End Service Type
// @optionalParam operatorImage string seldonio/cluster-manager:0.1.4-SNAPSHOT Seldon cluster manager image version
// @optionalParam operatorSpringOpts string null cluster manager spring opts
// @optionalParam operatorJavaOpts string null cluster manager java opts
// @optionalParam engineImage string seldonio/engine:0.1.4-SNAPSHOT Seldon engine image version

// TODO(https://github.com/ksonnet/ksonnet/issues/222): We have to add namespace as an explicit parameter
// because ksonnet doesn't support inheriting it from the environment yet.
Expand All @@ -21,46 +21,47 @@ local core = import "seldon-core/seldon-core/core.libsonnet";

local name = import 'param://name';
local namespace = import 'param://namespace';
local apifeImage = import 'param://apifeImage';
local serviceType = import 'param://serviceType';
local withRbac = import 'param://withRbac';
local withApife = import 'param://withApife';

local engineImage = import 'param://engineImage';
local clusterManagerImage = import 'param://clusterManagerImage';
local springOptsParam = import 'param://springOpts';
local springOpts = if springOptsParam != "null" then springOptsParam else null;
local javaOptsParam = import 'param://javaOpts';
local javaOpts = if javaOptsParam != "null" then javaOptsParam else null;
// APIFE
local apifeImage = import 'param://apifeImage';
local apifeServiceType = import 'param://apifeServiceType';

//std.prune(k.core.v1.list.new(
// Cluster Manager (The CRD Operator)
local operatorImage = import 'param://operatorImage';
local operatorSpringOptsParam = import 'param://operatorSpringOpts';
local operatorSpringOpts = if operatorSpringOptsParam != "null" then operatorSpringOptsParam else "";
local operatorJavaOptsParam = import 'param://operatorJavaOpts';
local operatorJavaOpts = if operatorJavaOptsParam != "null" then operatorJavaOptsParam else "";

// seldon-core components
local apife = if withRbac == "true" then
[core.parts(namespace).apifeWithRbac(apifeImage),core.parts(namespace).apifeService(serviceType),core.parts(namespace).rbacServiceAccount(),core.parts(namespace).rbacClusterRoleBinding()]
else
[core.parts(namespace).apife(apifeImage),core.parts(namespace).apifeService(serviceType)];
// Engine
local engineImage = import 'param://engineImage';

// APIFE
local apife = [
core.parts(namespace).apife(apifeImage, withRbac),
core.parts(namespace).apifeService(apifeServiceType),
];

local rbac = [
core.parts(namespace).rbacServiceAccount(),
core.parts(namespace).rbacClusterRoleBinding(),
];

local coreComponents = [
core.parts(namespace).deploymentOperator(engineImage, clusterManagerImage, springOpts, javaOpts),
core.parts(namespace).redisDeployment(),
// Core
local coreComponents = [
core.parts(namespace).deploymentOperator(engineImage, operatorImage, operatorSpringOpts, operatorJavaOpts, withRbac),
core.parts(namespace).redisDeployment(),
core.parts(namespace).redisService(),
core.parts(namespace).crd(),
];



if withApife == "true" then
if withRbac == "true" && withApife == "true" then
k.core.v1.list.new(apife + rbac + coreComponents)
else if withRbac == "true" && withApife == "false" then
k.core.v1.list.new(rbac + coreComponents)
else if withRbac == "false" && withApife == "true" then
k.core.v1.list.new(apife + coreComponents)
else
else if withRbac == "false" && withApife == "false" then
k.core.v1.list.new(coreComponents)

//k.core.v1.list.new([
// apife,
// k.core.v1.list.new([
// core.parts(namespace).apifeService(serviceType),
// core.parts(namespace).deploymentOperator(engineImage, clusterManagerImage, springOpts, javaOpts),
// core.parts(namespace).redisDeployment(),
// core.parts(namespace).redisService(),])
//])
Loading

0 comments on commit 72f900a

Please sign in to comment.