Skip to content

Commit

Permalink
Add cloud sql and gcs connection for pipeline-lite deployment (kubefl…
Browse files Browse the repository at this point in the history
…ow#1910)

* restructure

* working example

* working example

* move mysql

* moving minio and mysql out

* add gcp

* add files

* fix test
  • Loading branch information
IronPan authored Aug 21, 2019
1 parent 9adf163 commit 2e7f2d4
Show file tree
Hide file tree
Showing 32 changed files with 179 additions and 20 deletions.
9 changes: 3 additions & 6 deletions manifests/kustomize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ To get latest kubectl, visit [here](https://kubernetes.io/docs/tasks/tools/insta

## Change deploy namespace
To deploy Kubeflow Pipelines in namespace FOO,
- Edit [kustomization.yaml](namespaced-install/kustomization.yaml) namespace section to FOO
- Edit [kustomization.yaml](env/dev/kustomization.yaml) namespace section to FOO
- Then run
```
kubectl kustomize . | kubectl apply -f -
kubectl kustomize env/dev | kubectl apply -f -
```

## Reinstall with existing data
TODO

## Disable the public endpoint
By default, the deployment install an [invert proxy agent](https://github.com/google/inverting-proxy) that exposes a public URL. If you want to skip installing it,
- Comment out the proxy component in the [kustomization.yaml](base/kustomization.yaml).
Expand All @@ -62,7 +59,7 @@ kubectl delete -f https://raw.githubusercontent.com/kubeflow/pipelines/$PIPELINE

Or if you deploy through kustomize
```
kubectl kustomize . | kubectl delete -f -
kubectl kustomize env/dev | kubectl delete -f -
```
# FAQ
If sample code requires a "user-gcp-sa" secret, you could create one by
Expand Down
1 change: 1 addition & 0 deletions manifests/kustomize/base/argo/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- minio-artifact-secret.yaml
- workflow-controller-configmap.yaml
- workflow-controller-deployment.yaml
- workflow-controller-role.yaml
Expand Down
6 changes: 0 additions & 6 deletions manifests/kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ kind: Kustomization
bases:
- argo
- crds
- minio
- mysql
- pipeline
- proxy

images:
- name: argoproj/workflow-controller
newTag: v2.3.0
- name: minio/minio
newTag: RELEASE.2018-02-09T22-40-05Z
- name: mysql
newTag: "5.6"
- name: gcr.io/ml-pipeline/api-server
newTag: 0.1.26
- name: gcr.io/ml-pipeline/persistenceagent
Expand Down
16 changes: 16 additions & 0 deletions manifests/kustomize/env/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../../namespaced
- minio
- mysql

# Replace with your namespace
namespace: kubeflow

images:
- name: mysql
newTag: "5.6"
- name: minio/minio
newTag: RELEASE.2018-02-09T22-40-05Z
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- minio-artifact-secret.yaml
- minio-deployment.yaml
- minio-pvc.yaml
- minio-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
value: minio
- name: MINIO_SECRET_KEY
value: minio123
image: gcr.io/ml-pipeline/minio:RELEASE.2018-02-09T22-40-05Z
image: gcr.io/ml-pipeline/minio:RELEASE.2019-08-14T20-37-41Z
name: minio
ports:
- containerPort: 9000
Expand Down
2 changes: 2 additions & 0 deletions manifests/kustomize/env/gcp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore the GCP service account ADC file
application_default_credentials.json
26 changes: 26 additions & 0 deletions manifests/kustomize/env/gcp/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../../namespaced
- minio
- mysql

# Replace with your namespace
namespace: kubeflow

patchesStrategicMerge:
- ml-pipeline-apiserver-deployment-patch.yaml

images:
- name: gcr.io/cloudsql-docker/gce-proxy
newTag: "1.14"
- name: minio/minio
newTag: RELEASE.2019-08-14T20-37-41Z

secretGenerator:
- name: user-gcp-sa
files:
# Create a service account key and stored as application_default_credentials.json in the same folder.
# https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys
- application_default_credentials.json
6 changes: 6 additions & 0 deletions manifests/kustomize/env/gcp/minio/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- minio-gcs-gateway-deployment.yaml
- minio-gcs-gateway-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: minio-deployment
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio:RELEASE.2019-08-14T20-37-41Z
args:
- gateway
- gcs
# Replace this with your own GCP project
- yang-experiment-6
env:
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/etc/credentials/application_default_credentials.json"
ports:
- containerPort: 9000
volumeMounts:
- name: gcp-sa-token
mountPath: "/etc/credentials"
readOnly: true
volumes:
- name: gcp-sa-token
secret:
secretName: user-gcp-sa
11 changes: 11 additions & 0 deletions manifests/kustomize/env/gcp/minio/minio-gcs-gateway-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: ml-pipeline
spec:
template:
spec:
containers:
- name: ml-pipeline-api-server
env:
- name: OBJECTSTORECONFIG_BUCKETNAME
# Replace with your own bucket name
value: 'yang-experiment-6-mlpipeline'
- name: DBCONFIG_PASSWORD
# Replace with your own CloudSQL password
value: '123'
42 changes: 42 additions & 0 deletions manifests/kustomize/env/gcp/mysql/cloudsql-proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: cloudsqlproxy
spec:
replicas: 1
template:
metadata:
labels:
app: cloudsqlproxy
spec:
containers:
- image: gcr.io/cloudsql-docker/gce-proxy:1.14
name: cloudsqlproxy
command: ["/cloud_sql_proxy",
"-dir=/cloudsql",
# Replace with your own CloudSQL instance ID
"-instances=yang-experiment-6:us-central1:kfp-test=tcp:0.0.0.0:3306",
"-credential_file=/credentials/application_default_credentials.json",
"term_timeout=10s"]
# set term_timeout if require graceful handling of shutdown
# NOTE: proxy will stop accepting new connections; only wait on existing connections
lifecycle:
preStop:
exec:
# (optional) add a preStop hook so that termination is delayed
# this is required if your server still require new connections (e.g., connection pools)
command: ['sleep', '10']
ports:
- name: port-database1
containerPort: 3306
volumeMounts:
- mountPath: /cloudsql
name: cloudsql
- mountPath: /credentials
name: gcp-sa-token
volumes:
- name: cloudsql
emptyDir:
- name: gcp-sa-token
secret:
secretName: user-gcp-sa
6 changes: 6 additions & 0 deletions manifests/kustomize/env/gcp/mysql/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- cloudsql-proxy-deployment.yaml
- mysql-service.yaml
10 changes: 10 additions & 0 deletions manifests/kustomize/env/gcp/mysql/mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
targetPort: port-database1
selector:
app: cloudsqlproxy
2 changes: 0 additions & 2 deletions manifests/kustomize/namespaced-install/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../base
- ../base

resources:
- namespace.yaml

namespace: kubeflow

patchesStrategicMerge:
- workflow-controller-configmap.yaml
- ml-pipeline-persistenceagent-deployment-patch.yaml
Expand Down
2 changes: 1 addition & 1 deletion test/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: Kustomization
# Actual image overrides will be added in test scripts.
images: []
resources:
- ../../manifests/kustomize/namespaced-install
- ../../manifests/kustomize/env/dev

0 comments on commit 2e7f2d4

Please sign in to comment.