Skip to content

Commit b086020

Browse files
authored
feat(deployment): add option to deploy mysql in KFP standalone (#9855)
* add option to deploy mysql * fix deployment errors * remove temp code in development * keep mysql deployment path same as before * change the generic folder * manifest error * revert default cache path * address comments
1 parent 5b59e4a commit b086020

14 files changed

+560
-4
lines changed

manifests/kustomize/base/cache/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- cache-deployment.yaml
5-
- cache-service.yaml
65
- cache-role.yaml
76
- cache-rolebinding.yaml
87
- cache-sa.yaml
8+
- cache-service.yaml
99
commonLabels:
1010
app: cache-server
1111
images:
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: cache-server
5+
labels:
6+
app: cache-server
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: cache-server
12+
template:
13+
metadata:
14+
labels:
15+
app: cache-server
16+
spec:
17+
containers:
18+
- name: server
19+
image: gcr.io/ml-pipeline/cache-server:dummy
20+
env:
21+
- name: DEFAULT_CACHE_STALENESS
22+
valueFrom:
23+
configMapKeyRef:
24+
name: pipeline-install-config
25+
key: DEFAULT_CACHE_STALENESS
26+
- name: MAXIMUM_CACHE_STALENESS
27+
valueFrom:
28+
configMapKeyRef:
29+
name: pipeline-install-config
30+
key: MAXIMUM_CACHE_STALENESS
31+
- name: CACHE_IMAGE
32+
valueFrom:
33+
configMapKeyRef:
34+
name: pipeline-install-config
35+
key: cacheImage
36+
- name: CACHE_NODE_RESTRICTIONS
37+
valueFrom:
38+
configMapKeyRef:
39+
name: pipeline-install-config
40+
key: cacheNodeRestrictions
41+
- name: DBCONFIG_DRIVER
42+
value: pgx
43+
- name: DBCONFIG_DB_NAME
44+
valueFrom:
45+
configMapKeyRef:
46+
name: pipeline-install-config
47+
key: cacheDb
48+
- name: DBCONFIG_HOST_NAME
49+
valueFrom:
50+
configMapKeyRef:
51+
name: pipeline-install-config
52+
key: postgresDbHost
53+
- name: DBCONFIG_PORT
54+
valueFrom:
55+
configMapKeyRef:
56+
name: pipeline-install-config
57+
key: postgresDbPort
58+
- name: DBCONFIG_USER
59+
valueFrom:
60+
secretKeyRef:
61+
name: postgres-secret
62+
key: username
63+
- name: DBCONFIG_PASSWORD
64+
valueFrom:
65+
secretKeyRef:
66+
name: postgres-secret
67+
key: password
68+
- name: NAMESPACE_TO_WATCH
69+
valueFrom:
70+
fieldRef:
71+
fieldPath: metadata.namespace
72+
# If you update WEBHOOK_PORT, also change the value of the
73+
# containerPort "webhook-api" to match.
74+
- name: WEBHOOK_PORT
75+
value: "8443"
76+
args: ["--db_driver=$(DBCONFIG_DRIVER)",
77+
"--db_host=$(DBCONFIG_HOST_NAME)",
78+
"--db_port=$(DBCONFIG_PORT)",
79+
"--db_name=$(DBCONFIG_DB_NAME)",
80+
"--db_user=$(DBCONFIG_USER)",
81+
"--db_password=$(DBCONFIG_PASSWORD)",
82+
"--namespace_to_watch=$(NAMESPACE_TO_WATCH)",
83+
"--listen_port=$(WEBHOOK_PORT)",
84+
]
85+
imagePullPolicy: Always
86+
ports:
87+
- containerPort: 8443
88+
name: webhook-api
89+
volumeMounts:
90+
- name: webhook-tls-certs
91+
mountPath: /etc/webhook/certs
92+
readOnly: true
93+
volumes:
94+
- name: webhook-tls-certs
95+
secret:
96+
secretName: webhook-server-tls
97+
serviceAccountName: kubeflow-pipelines-cache
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- cache-deployment.yaml
5+
- ../cache-role.yaml
6+
- ../cache-rolebinding.yaml
7+
- ../cache-sa.yaml
8+
- ../cache-service.yaml
9+
commonLabels:
10+
app: cache-server
11+
images:
12+
- name: gcr.io/ml-pipeline/cache-server
13+
newTag: 2.0.0

manifests/kustomize/base/installs/generic/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ vars:
4545
fieldref:
4646
fieldpath: data.defaultPipelineRoot
4747
configurations:
48-
- params.yaml
48+
- params.yaml

manifests/kustomize/base/installs/generic/pipeline-install-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ data:
1212
namespace: `kubectl rollout restart deployment -n <your-namespace>`.
1313
appName: pipeline
1414
appVersion: 2.0.1
15-
dbHost: mysql
16-
dbPort: "3306"
15+
dbHost: mysql # relic to be removed after release
16+
dbPort: "3306" # relic to be removed after release
17+
dbType: mysql
18+
mysqlHost: mysql
19+
mysqlPort: "3306"
1720
mlmdDb: metadb
1821
cacheDb: cachedb
1922
pipelineDb: mlpipeline
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: kubeflow
4+
bases:
5+
- ../../../pipeline/postgres
6+
- ../../../cache/postgres
7+
- ../../../cache-deployer
8+
resources:
9+
- pipeline-install-config.yaml
10+
- postgres-secret.yaml
11+
vars:
12+
- name: kfp-namespace
13+
objref:
14+
kind: Deployment
15+
apiVersion: apps/v1
16+
name: ml-pipeline
17+
fieldref:
18+
fieldpath: metadata.namespace
19+
- name: kfp-app-name
20+
objref:
21+
kind: ConfigMap
22+
name: pipeline-install-config
23+
apiVersion: v1
24+
fieldref:
25+
fieldpath: data.appName
26+
- name: kfp-app-version
27+
objref:
28+
kind: ConfigMap
29+
name: pipeline-install-config
30+
apiVersion: v1
31+
fieldref:
32+
fieldpath: data.appVersion
33+
- name: kfp-artifact-bucket-name
34+
objref:
35+
kind: ConfigMap
36+
name: pipeline-install-config
37+
apiVersion: v1
38+
fieldref:
39+
fieldpath: data.bucketName
40+
- name: kfp-default-pipeline-root
41+
objref:
42+
kind: ConfigMap
43+
name: pipeline-install-config
44+
apiVersion: v1
45+
fieldref:
46+
fieldpath: data.defaultPipelineRoot
47+
configurations:
48+
- params.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Allow Kustomize var to replace following fields.
2+
varReference:
3+
- path: data/config
4+
kind: ConfigMap
5+
- path: data/defaultPipelineRoot
6+
kind: ConfigMap
7+
- path: metadata/name
8+
kind: Application
9+
- path: spec/descriptor/version
10+
kind: Application
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: pipeline-install-config
5+
data:
6+
warning: |
7+
1. Do not use kubectl to edit this configmap, because some values are used
8+
during kustomize build. Instead, change the configmap and apply the entire
9+
kustomize manifests again.
10+
2. After updating the configmap, some deployments may need to be restarted
11+
until the changes take effect. A quick way to restart all deployments in a
12+
namespace: `kubectl rollout restart deployment -n <your-namespace>`.
13+
appName: pipeline
14+
appVersion: 2.0.0
15+
dbHost: postgres # relic to be removed after release
16+
dbPort: "5432" # relic to be removed after release
17+
dbType: postgres
18+
postgresHost: postgres
19+
postgresPort: "5432"
20+
mlmdDb: metadb
21+
cacheDb: cachedb
22+
pipelineDb: mlpipeline
23+
bucketName: mlpipeline
24+
## defaultPipelineRoot: Optional. Default pipeline root in v2 compatible mode.
25+
## https://www.kubeflow.org/docs/components/pipelines/sdk/v2/v2-compatibility/
26+
##
27+
## If the field is not set, kfp-launcher configmaps won't be created and
28+
## v2 compatible mode defaults to minio://mlpipeline/v2/artifacts as pipeline
29+
## root.
30+
##
31+
## When not in Kubeflow Pipelines multi-user mode, the config works as you
32+
## would normally expect.
33+
##
34+
## In Kubeflow Pipelines multi-user mode, the config creates default
35+
## kfp-launcher configmaps in each user's namespace. Users can edit the
36+
## kfp-launcher configmap's defaultPipelineRoot field afterwards to configure
37+
## namespace-specific default pipeline root. The namespace specific changes in
38+
## kfp-launcher configmap won't be overridden by pipeline-install-config.
39+
##
40+
## Caveat: when you update the config from a non-empty value, only new
41+
## namespaces get the updated config by default. Owners of existing namespaces
42+
## must delete the kfp-launcher configmap to get the new default config value.
43+
##
44+
## Examples:
45+
## defaultPipelineRoot: minio://mlpipeline/v2/artifacts
46+
## defaultPipelineRoot: gs://your-bucket/path/to/artifacts
47+
## defaultPipelineRoot: s3://your-bucket/path/to/artifacts
48+
##
49+
## V2 Compatible Mode Feature stage:
50+
## [Beta](https://github.com/kubeflow/pipelines/blob/master/docs/release/feature-stages.md#beta)
51+
defaultPipelineRoot: ""
52+
## autoUpdatePipelineDefaultVersion: States if the pipeline version
53+
## should be updated by defult for a versioned pipeline or not when a new
54+
## version is uploaded. This sets the deployment wide definition.
55+
autoUpdatePipelineDefaultVersion: "true"
56+
## cronScheduleTimezone: States the timezone which should be used for
57+
## the cron scheduler. If not specified the local timezone of the
58+
## cluster will be used. Valid values are UTC, Local or values according to
59+
## the IANA Time Zone database, such as "America/New_York" and "Asia/Shanghai".
60+
## Feature stage:
61+
## [Alpha](https://github.com/kubeflow/pipelines/blob/master/docs/release/feature-stages.md#alpha)
62+
cronScheduleTimezone: "UTC"
63+
## cacheImage is the image that the mutating webhook will use to patch
64+
## cached steps with. Will be used to echo a message announcing that
65+
## the cached step result will be used. If not set it will default to
66+
## 'gcr.io/google-containers/busybox'
67+
cacheImage: "gcr.io/google-containers/busybox"
68+
## cacheNodeRestrictions the dummy container runing if output is cached
69+
## will run with the same affinity and node selector as the default pipeline
70+
## step. This is defaulted to 'false' to allow the pod to be scheduled on
71+
## any node and avoid defaulting to specific nodes. Allowed values are:
72+
## 'false' and 'true'.
73+
cacheNodeRestrictions: "false"
74+
## MAXIMUM_CACHE_STALENESS configures caching according to
75+
## https://www.kubeflow.org/docs/components/pipelines/overview/caching/ and
76+
## https://www.kubeflow.org/docs/components/pipelines/overview/caching-v2/.
77+
## Larger than MAXIMUM_CACHE_STALENESS per pipeline user set values are
78+
## reduced to MAXIMUM_CACHE_STALENESS.
79+
## The administrator of the storage backend can rely on it to delete old cache
80+
## artifacts.
81+
MAXIMUM_CACHE_STALENESS: ""
82+
## MAXIMUM_CACHE_STALENESS: "P30D"
83+
## DEFAULT_CACHE_STALENESS configures caching according to
84+
## https://www.kubeflow.org/docs/components/pipelines/overview/caching/ and
85+
## https://www.kubeflow.org/docs/components/pipelines/overview/caching-v2/.
86+
## This value is used if the user did not set a value in the pipeline.
87+
DEFAULT_CACHE_STALENESS: ""
88+
## DEFAULT_CACHE_STALENESS: "P7D"
89+
## ConMaxLifeTime will set the connection max lifetime for MySQL
90+
## this is very important to setup when using external databases.
91+
## See this issue for more details: https://github.com/kubeflow/pipelines/issues/5329
92+
## Note: this value should be a string that can be parsed by `time.ParseDuration`.
93+
## If this value doesn't include a unit abbreviation, the units will be assumed
94+
## to be nanoseconds.
95+
ConMaxLifeTime: "120s"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Secret
2+
apiVersion: v1
3+
metadata:
4+
name: postgres-secret
5+
stringData:
6+
username: user
7+
password: "password"

manifests/kustomize/base/pipeline/ml-pipeline-apiserver-deployment.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ spec:
3333
configMapKeyRef:
3434
name: pipeline-install-config
3535
key: bucketName
36+
# relic variables
3637
- name: DBCONFIG_USER
3738
valueFrom:
3839
secretKeyRef:
@@ -58,11 +59,44 @@ spec:
5859
configMapKeyRef:
5960
name: pipeline-install-config
6061
key: dbPort
62+
# end of relic variables
6163
- name: DBCONFIG_CONMAXLIFETIME
6264
valueFrom:
6365
configMapKeyRef:
6466
name: pipeline-install-config
6567
key: ConMaxLifeTime
68+
- name: DB_DRIVER_NAME
69+
valueFrom:
70+
configMapKeyRef:
71+
name: pipeline-install-config
72+
key: dbType
73+
# MySQL Config
74+
- name: DBCONFIG_MYSQLCONFIG_USER
75+
valueFrom:
76+
secretKeyRef:
77+
name: mysql-secret
78+
key: username
79+
- name: DBCONFIG_MYSQLCONFIG_PASSWORD
80+
valueFrom:
81+
secretKeyRef:
82+
name: mysql-secret
83+
key: password
84+
- name: DBCONFIG_MYSQLCONFIG_DBNAME
85+
valueFrom:
86+
configMapKeyRef:
87+
name: pipeline-install-config
88+
key: pipelineDb
89+
- name: DBCONFIG_MYSQLCONFIG_HOST
90+
valueFrom:
91+
configMapKeyRef:
92+
name: pipeline-install-config
93+
key: mysqlHost
94+
- name: DBCONFIG_MYSQLCONFIG_PORT
95+
valueFrom:
96+
configMapKeyRef:
97+
name: pipeline-install-config
98+
key: mysqlPort
99+
# end of MySQL Config
66100
- name: OBJECTSTORECONFIG_ACCESSKEY
67101
valueFrom:
68102
secretKeyRef:

0 commit comments

Comments
 (0)