Skip to content

Commit

Permalink
metadata db in overlay (kubeflow#673)
Browse files Browse the repository at this point in the history
* move metadata-db from base to separate overlay
use parameter files for db configuration

* kfdef files use db overlay for metadata component

* update metadata tests

* disable namesuffixhash for generated resources

* add prefix to generated resources

* update unit test
  • Loading branch information
xaniasd authored and k8s-ci-robot committed Dec 17, 2019
1 parent 980d9e6 commit fde69d7
Show file tree
Hide file tree
Showing 23 changed files with 651 additions and 735 deletions.
1 change: 1 addition & 0 deletions kfdef/kfctl_anthos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_aws_cognito.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_gcp_basic_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_gcp_iap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_istio_dex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
1 change: 1 addition & 0 deletions kfdef/kfctl_k8s_istio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ spec:
overlays:
- istio
- application
- db
repoRef:
name: manifests
path: metadata
Expand Down
5 changes: 0 additions & 5 deletions metadata/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ configMapGenerator:
- name: ui-parameters
env: params.env
resources:
- metadata-db-pvc.yaml
- metadata-db-configmap.yaml
- metadata-db-secret.yaml
- metadata-db-deployment.yaml
- metadata-db-service.yaml
- metadata-deployment.yaml
- metadata-service.yaml
- metadata-ui-deployment.yaml
Expand Down
7 changes: 0 additions & 7 deletions metadata/base/metadata-db-configmap.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions metadata/base/metadata-db-secret.yaml

This file was deleted.

57 changes: 2 additions & 55 deletions metadata/base/metadata-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,8 @@ spec:
containers:
- name: container
image: gcr.io/kubeflow-images-public/metadata:v0.1.11
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: metadata-db-secrets
key: password
- name: MYSQL_USER_NAME
valueFrom:
secretKeyRef:
name: metadata-db-secrets
key: username
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: metadata-db-configmap
key: mysql_database
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: metadata-db-configmap
key: mysql_port
command: ["./server/server",
"--http_port=8080",
"--mysql_service_host=metadata-db.kubeflow",
"--mysql_service_port=$(MYSQL_PORT)",
"--mysql_service_user=$(MYSQL_USER_NAME)",
"--mysql_service_password=$(MYSQL_ROOT_PASSWORD)",
"--mlmd_db_name=$(MYSQL_DATABASE)"]
"--http_port=8080"]
ports:
- name: backendapi
containerPort: 8080
Expand Down Expand Up @@ -79,35 +53,8 @@ spec:
containers:
- name: container
image: gcr.io/tfx-oss-public/ml_metadata_store_server:0.15.1
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: metadata-db-secrets
key: password
- name: MYSQL_USER_NAME
valueFrom:
secretKeyRef:
name: metadata-db-secrets
key: username
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: metadata-db-configmap
key: mysql_database
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: metadata-db-configmap
key: mysql_port
command: ["/bin/metadata_store_server"]
args: ["--grpc_port=8080",
"--mysql_config_host=metadata-db.kubeflow",
"--mysql_config_database=$(MYSQL_DATABASE)",
"--mysql_config_port=$(MYSQL_PORT)",
"--mysql_config_user=$(MYSQL_USER_NAME)",
"--mysql_config_password=$(MYSQL_ROOT_PASSWORD)"
]
args: ["--grpc_port=8080"]
ports:
- name: grpc-backendapi
containerPort: 8080
34 changes: 34 additions & 0 deletions metadata/overlays/db/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
kustomize.component: metadata
namespace: kubeflow
generatorOptions:
# name suffix hash is not propagated correctly to base resources
disableNameSuffixHash: true
configMapGenerator:
- name: metadata-db-parameters
env: params.env
secretGenerator:
- name: metadata-db-secrets
env: secrets.env
bases:
- ../../base
resources:
- metadata-db-pvc.yaml
- metadata-db-deployment.yaml
- metadata-db-service.yaml
patchesStrategicMerge:
- metadata-deployment.yaml
images:
- name: mysql
newName: mysql
newTag: 8.0.3
vars:
- name: metadata-db-service
objref:
kind: Service
name: metadata-db
apiVersion: v1
fieldref:
fieldpath: metadata.name
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: db
name: metadata-db
labels:
component: db
spec:
selector:
matchLabels:
component: db
replicas: 1
template:
metadata:
Expand All @@ -18,19 +21,11 @@ spec:
args:
- --datadir
- /var/lib/mysql/datadir
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: metadata-db-secrets
key: password
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: "true"
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: metadata-db-configmap
key: mysql_database
envFrom:
- configMapRef:
name: metadata-db-parameters
- secretRef:
name: metadata-db-secrets
ports:
- name: dbapi
containerPort: 3306
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql
name: metadata-mysql
spec:
accessModes:
- ReadWriteOnce
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: db
name: metadata-db
labels:
component: db
spec:
Expand Down
61 changes: 61 additions & 0 deletions metadata/overlays/db/metadata-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment
labels:
component: server
spec:
replicas: 1
selector:
matchLabels:
component: server
template:
metadata:
labels:
component: server
spec:
containers:
- name: container
envFrom:
- configMapRef:
name: metadata-db-parameters
- secretRef:
name: metadata-db-secrets
command: ["./server/server",
"--http_port=8080",
"--mysql_service_host=$(metadata-db-service)",
"--mysql_service_port=$(MYSQL_PORT)",
"--mysql_service_user=$(MYSQL_USER_NAME)",
"--mysql_service_password=$(MYSQL_ROOT_PASSWORD)",
"--mlmd_db_name=$(MYSQL_DATABASE)"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: grpc-deployment
labels:
component: grpc-server
spec:
replicas: 1
selector:
matchLabels:
component: grpc-server
template:
metadata:
labels:
component: grpc-server
spec:
containers:
- name: container
envFrom:
- configMapRef:
name: metadata-db-parameters
- secretRef:
name: metadata-db-secrets
args: ["--grpc_port=8080",
"--mysql_config_host=$(metadata-db-service)",
"--mysql_config_database=$(MYSQL_DATABASE)",
"--mysql_config_port=$(MYSQL_PORT)",
"--mysql_config_user=$(MYSQL_USER_NAME)",
"--mysql_config_password=$(MYSQL_ROOT_PASSWORD)"
]
3 changes: 3 additions & 0 deletions 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
2 changes: 2 additions & 0 deletions 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
Loading

0 comments on commit fde69d7

Please sign in to comment.