Skip to content

Commit

Permalink
chore(manifests): Move metadata to third-party and add overlay for se…
Browse files Browse the repository at this point in the history
…parate db (kubeflow#5345)

* manifests: Add overlay for separate db to metadata

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* manifests: Refactor kustomizations to use metadata from third-party folder

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* manifests: Add platform-agnostic-multi-user-legacy env

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
  • Loading branch information
yanniszark authored Mar 24, 2021
1 parent 42630cb commit d9c0196
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: Kustomization
namespace: kubeflow
bases:
- ../../pipeline
- ../../metadata
- ../../cache
- ../../cache-deployer
resources:
Expand Down
39 changes: 39 additions & 0 deletions manifests/kustomize/base/metadata/overlays/db/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kubeflow

bases:
- ../../base
resources:
- metadata-db-pvc.yaml
- metadata-db-deployment.yaml
- metadata-db-service.yaml

patchesStrategicMerge:
- patches/metadata-grpc-deployment.yaml

configMapGenerator:
- name: metadata-db-parameters
envs:
- params.env
secretGenerator:
- name: metadata-db-secrets
envs:
- secrets.env
generatorOptions:
disableNameSuffixHash: true


images:
- name: mysql
newName: mysql
newTag: 8.0.3

vars:
- name: MLMD_DB_HOST
objref:
kind: Service
name: metadata-db
apiVersion: v1
fieldref:
fieldpath: metadata.name
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: metadata-db
labels:
component: db
spec:
selector:
matchLabels:
component: db
replicas: 1
strategy:
type: Recreate
template:
metadata:
name: db
labels:
component: db
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: db-container
image: mysql:8.0.3
args:
- --datadir
- /var/lib/mysql/datadir
envFrom:
- configMapRef:
name: metadata-db-parameters
- secretRef:
name: metadata-db-secrets
ports:
- name: dbapi
containerPort: 3306
readinessProbe:
exec:
command:
- "/bin/bash"
- "-c"
- "mysql -D $$MYSQL_DATABASE -p$$MYSQL_ROOT_PASSWORD -e 'SELECT 1'"
initialDelaySeconds: 5
periodSeconds: 2
timeoutSeconds: 1
volumeMounts:
- name: metadata-mysql
mountPath: /var/lib/mysql
volumes:
- name: metadata-mysql
persistentVolumeClaim:
claimName: metadata-mysql

10 changes: 10 additions & 0 deletions manifests/kustomize/base/metadata/overlays/db/metadata-db-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: metadata-mysql
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: metadata-db
labels:
component: db
spec:
type: ClusterIP
ports:
- port: 3306
protocol: TCP
name: dbapi
selector:
component: db
3 changes: 3 additions & 0 deletions manifests/kustomize/base/metadata/overlays/db/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MYSQL_DATABASE=metadb
MYSQL_PORT=3306
MYSQL_ALLOW_EMPTY_PASSWORD=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: metadata-grpc-deployment
spec:
template:
spec:
containers:
- name: container
# Remove existing environment variables
env:
- $patch: replace
envFrom:
- configMapRef:
name: metadata-db-parameters
- secretRef:
name: metadata-db-secrets
- configMapRef:
name: metadata-grpc-configmap
args: ["--grpc_port=$(METADATA_GRPC_SERVICE_PORT)",
"--mysql_config_host=$(MLMD_DB_HOST)",
"--mysql_config_database=$(MYSQL_DATABASE)",
"--mysql_config_port=$(MYSQL_PORT)",
"--mysql_config_user=$(MYSQL_USER_NAME)",
"--mysql_config_password=$(MYSQL_ROOT_PASSWORD)"]
2 changes: 2 additions & 0 deletions manifests/kustomize/base/metadata/overlays/db/secrets.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MYSQL_USER_NAME=root
MYSQL_ROOT_PASSWORD=test
1 change: 1 addition & 0 deletions manifests/kustomize/env/azure/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace: kubeflow

bases:
- ../../base/installs/generic
- ../../base/metadata/base
- ../../third-party/argo/installs/namespace
- minio-azure-gateway

Expand Down
1 change: 1 addition & 0 deletions manifests/kustomize/env/gcp/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bases:
- ../../third-party/application
- ../../base/application
- ../../base/installs/generic
- ../../base/metadata/base
- ../../third-party/argo/installs/namespace
- inverse-proxy
- minio-gcs-gateway
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../../base/installs/multi-user
- ../../base/metadata/overlays/db
- ../../third-party/argo/installs/cluster
- ../../third-party/mysql
- ../../third-party/minio

# Identifier for application manager to apply ownerReference.
# The ownerReference ensures the resources get garbage collected
# when application is deleted.
commonLabels:
application-crd-id: kubeflow-pipelines

# !!! If you want to customize the namespace,
# please also update base/cache-deployer/cluster-scoped/cache-deployer-clusterrolebinding.yaml
namespace: kubeflow
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Kustomization

bases:
- ../../base/installs/multi-user
- ../../base/metadata/base
- ../../third-party/argo/installs/cluster
- ../../third-party/mysql
- ../../third-party/minio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Kustomization

bases:
- ../../base/installs/generic
- ../../base/metadata/base
- ../../third-party/argo/installs/namespace
- ../../third-party/minio
- ../../third-party/mysql
Expand Down

0 comments on commit d9c0196

Please sign in to comment.