Skip to content

Commit

Permalink
Pipelines on k8s (#142)
Browse files Browse the repository at this point in the history
* fix dataflow bugs

* lint

* small updates for docker compose tests

* update install doc at top of notebook

* Typo fix

* k8s pipeline

* lint

Co-authored-by: Andrei Paleyes <[email protected]>
  • Loading branch information
ukclivecox and apaleyes authored Apr 8, 2022
1 parent 3bf3e96 commit c89ae5a
Show file tree
Hide file tree
Showing 18 changed files with 532 additions and 69 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ undeploy-local-triton:
.PHONY: deploy-k8s
deploy-k8s:
kubectl create -f k8s/seldon-v2-crds.yaml
sleep 1
kubectl wait --for condition=established --timeout=60s crd/servers.mlops.seldon.io
kubectl wait --for condition=established --timeout=60s crd/serverconfigs.mlops.seldon.io
kubectl create -f k8s/seldon-v2-components.yaml
Expand Down
181 changes: 154 additions & 27 deletions k8s/seldon-v2-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ subjects:
---
apiVersion: v1
data:
agent.yaml: "rclone: \n config_secrets: [\"seldon-rclone-gs-public\"]"
agent.yaml: "rclone: \n config_secrets: [\"seldon-rclone-gs-public\"]\nkafka:\n active: true\n broker: \"seldon-kafka-plain-bootstrap.kafka:9092\""
kind: ConfigMap
metadata:
name: seldon-agent
Expand Down Expand Up @@ -490,6 +490,27 @@ spec:
---
apiVersion: v1
kind: Service
metadata:
labels:
app: seldon-mesh
name: seldon-pipelinegateway
namespace: seldon-mesh
spec:
clusterIP: None
ports:
- name: http
port: 9010
protocol: TCP
targetPort: http
- name: grpc
port: 9011
protocol: TCP
targetPort: grpc
selector:
app: pipelinegateway
---
apiVersion: v1
kind: Service
metadata:
labels:
app: seldon-scheduler
Expand All @@ -509,6 +530,10 @@ spec:
port: 9005
protocol: TCP
targetPort: agent
- name: dataflow
port: 9008
protocol: TCP
targetPort: dataflow
selector:
control-plane: seldon-scheduler
type: LoadBalancer
Expand Down Expand Up @@ -592,6 +617,47 @@ spec:
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: seldon-dataflow-engine
name: seldon-dataflow-engine
namespace: seldon-mesh
spec:
replicas: 1
selector:
matchLabels:
control-plane: seldon-dataflow-engine
template:
metadata:
labels:
control-plane: seldon-dataflow-engine
spec:
containers:
- env:
- name: SELDON_KAFKA_BOOTSTRAP_SERVERS
value: seldon-kafka-plain-bootstrap.kafka:9092
- name: SELDON_UPSTREAM_HOST
value: seldon-scheduler
- name: SELDON_UPSTREAM_PORT
value: "9008"
- name: SELDON_CORES_COUNT
value: "4"
image: seldonio/seldon-dataflow-engine:latest
imagePullPolicy: IfNotPresent
name: dataflow-engine
resources:
limits:
cpu: 4
memory: 2G
requests:
cpu: 1
memory: 1G
securityContext:
runAsUser: 8888
terminationGracePeriodSeconds: 5
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: seldon-envoy
Expand Down Expand Up @@ -625,72 +691,83 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: seldon-scheduler
name: seldon-scheduler
control-plane: seldon-modelgateway
name: seldon-modelgateway
namespace: seldon-mesh
spec:
replicas: 1
selector:
matchLabels:
control-plane: seldon-scheduler
control-plane: seldon-modelgateway
template:
metadata:
labels:
control-plane: seldon-scheduler
control-plane: seldon-modelgateway
spec:
containers:
- command:
- /bin/scheduler
image: seldonio/seldon-scheduler:latest
- args:
- --scheduler-host=seldon-scheduler
- --scheduler-port=9004
- --envoy-host=seldon-mesh
- --envoy-port=80
command:
- /bin/modelgateway
image: seldonio/seldon-modelgateway:latest
imagePullPolicy: IfNotPresent
name: scheduler
ports:
- containerPort: 9002
name: xds
- containerPort: 9004
name: scheduler
- containerPort: 9005
name: agent
name: modelgateway
resources:
limits:
cpu: 500m
memory: 300Mi
requests:
cpu: 100m
memory: 200Mi
volumeMounts:
- mountPath: /mnt/config
name: config-volume
securityContext:
runAsUser: 8888
serviceAccountName: seldon-scheduler
terminationGracePeriodSeconds: 5
volumes:
- configMap:
name: seldon-agent
name: config-volume
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: seldon-stream
name: seldon-stream
app: pipelinegateway
name: seldon-pipelinegateway
namespace: seldon-mesh
spec:
replicas: 1
selector:
matchLabels:
control-plane: seldon-stream
app: pipelinegateway
template:
metadata:
labels:
control-plane: seldon-stream
app: pipelinegateway
spec:
containers:
- args:
- --scheduler-host=seldon-scheduler
- --scheduler-port=9004
- --envoy-host=seldon-mesh
- --envoy-port=80
- --http-port=9010
- --grpc-port=9011
- --config-path=/mnt/config
command:
- /bin/stream
image: seldonio/seldon-stream:latest
- /bin/pipelinegateway
image: seldonio/seldon-pipelinegateway:latest
imagePullPolicy: IfNotPresent
name: stream
name: pipelinegateway
ports:
- containerPort: 9010
name: http
protocol: TCP
- containerPort: 9011
name: grpc
protocol: TCP
resources:
limits:
cpu: 500m
Expand All @@ -710,6 +787,52 @@ spec:
name: seldon-agent
name: config-volume
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: seldon-scheduler
name: seldon-scheduler
namespace: seldon-mesh
spec:
replicas: 1
selector:
matchLabels:
control-plane: seldon-scheduler
template:
metadata:
labels:
control-plane: seldon-scheduler
spec:
containers:
- args:
- --pipeline-gateway-host=seldon-pipelinegateway
command:
- /bin/scheduler
image: seldonio/seldon-scheduler:latest
imagePullPolicy: IfNotPresent
name: scheduler
ports:
- containerPort: 9002
name: xds
- containerPort: 9004
name: scheduler
- containerPort: 9005
name: agent
- containerPort: 9008
name: dataflow
resources:
limits:
cpu: 500m
memory: 300Mi
requests:
cpu: 100m
memory: 200Mi
securityContext:
runAsUser: 8888
serviceAccountName: seldon-scheduler
terminationGracePeriodSeconds: 5
---
apiVersion: mlops.seldon.io/v1alpha1
kind: ServerConfig
metadata:
Expand Down Expand Up @@ -839,6 +962,8 @@ spec:
name: mlserver-models
readOnly: true
securityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
serviceAccountName: seldon-server
terminationGracePeriodSeconds: 30
Expand Down Expand Up @@ -983,6 +1108,8 @@ spec:
name: triton-models
readOnly: true
securityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
serviceAccountName: seldon-server
terminationGracePeriodSeconds: 30
Expand Down
5 changes: 5 additions & 0 deletions k8s/seldon-v2-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ spec:
passEmptyResponses:
description: 'Whether empty tensors output should be passed to onwards Default: false'
type: boolean
tensorMap:
additionalProperties:
type: string
description: Map of tensor name conversions to use e.g. output1 -> input1
type: object
required:
- name
type: object
Expand Down
4 changes: 4 additions & 0 deletions operator/controllers/mlops/experiment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package mlops
import (
"context"

"sigs.k8s.io/controller-runtime/pkg/predicate"

"github.com/seldonio/seldon-core/operatorv2/pkg/constants"
"github.com/seldonio/seldon-core/operatorv2/pkg/utils"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -110,7 +112,9 @@ func (r *ExperimentReconciler) Reconcile(ctx context.Context, req ctrl.Request)

// SetupWithManager sets up the controller with the Manager.
func (r *ExperimentReconciler) SetupWithManager(mgr ctrl.Manager) error {
pred := predicate.GenerationChangedPredicate{}
return ctrl.NewControllerManagedBy(mgr).
For(&mlopsv1alpha1.Experiment{}).
WithEventFilter(pred).
Complete(r)
}
4 changes: 4 additions & 0 deletions operator/controllers/mlops/pipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package mlops
import (
"context"

"sigs.k8s.io/controller-runtime/pkg/predicate"

"github.com/seldonio/seldon-core/operatorv2/pkg/constants"
"github.com/seldonio/seldon-core/operatorv2/pkg/utils"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -111,7 +113,9 @@ func (r *PipelineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c

// SetupWithManager sets up the controller with the Manager.
func (r *PipelineReconciler) SetupWithManager(mgr ctrl.Manager) error {
pred := predicate.GenerationChangedPredicate{}
return ctrl.NewControllerManagedBy(mgr).
For(&mlopsv1alpha1.Pipeline{}).
WithEventFilter(pred).
Complete(r)
}
Loading

0 comments on commit c89ae5a

Please sign in to comment.