metadata: Deployment scripts update (#2180)

Change to parameterize database_name, host and port for metadata
deployment using config maps
This commit is contained in:
dushyanthsc 2019-09-20 16:45:25 -07:00 committed by Kubernetes Prow Robot
parent ec1ae92210
commit 57d9f7f1cf
4 changed files with 62 additions and 10 deletions

View File

@ -55,15 +55,26 @@ spec:
- name: DBCONFIG_PASSWORD
value: ''
{{ end }}
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_database
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_port
command: ["/bin/metadata_store_server"]
args: ["--grpc_port=8080",
"--mysql_config_host=mysql",
{{ if .Values.managedstorage.databaseNamePrefix }}
'--mysql_config_database={{ .Values.managedstorage.databaseNamePrefix }}_metadata',
{{ else }}
'--mysql_config_database={{ .Release.Name | replace "-" "_" | replace "." "_"}}_metadata',
{{ end }}
"--mysql_config_port=3306",
"--mysql_config_database=$(MYSQL_DATABASE)",
"--mysql_config_host=$(MYSQL_HOST)",
"--mysql_config_port=$(MYSQL_PORT)",
"--mysql_config_user=$(DBCONFIG_USER)",
"--mysql_config_password=$(DBCONFIG_PASSWORD)"
]
@ -112,3 +123,18 @@ spec:
containerPort: 9090
- name: envoy-admin
containerPort: 9901
---
apiVersion: v1
kind: ConfigMap
metadata:
name: metadata-configmap
labels:
component: metadata-server
data:
{{ if .Values.managedstorage.databaseNamePrefix }}
mysql_database:{{ .Values.managedstorage.databaseNamePrefix }}_metadata',
{{ else }}
mysql_database:{{ .Release.Name | replace "-" "_" | replace "." "_"}}_metadata',
{{ end }}
mysql_host: "mysql"
mysql_port: "3306"

View File

@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- metadata-configmap.yaml
- metadata-deployment.yaml
- metadata-service.yaml
- metadata-envoy-deployment.yaml

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: metadata-configmap
labels:
component: metadata-server
data:
mysql_database: "metadb"
mysql_host: "mysql"
mysql_port: "3306"

View File

@ -28,11 +28,26 @@ spec:
secretKeyRef:
name: mysql-credential
key: password
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_database
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: metadata-configmap
key: mysql_port
command: ["/bin/metadata_store_server"]
args: ["--grpc_port=8080",
"--mysql_config_host=mysql",
"--mysql_config_database=metadb",
"--mysql_config_port=3306",
"--mysql_config_database=$(MYSQL_DATABASE)",
"--mysql_config_host=$(MYSQL_HOST)",
"--mysql_config_port=$(MYSQL_PORT)",
"--mysql_config_user=$(DBCONFIG_USER)",
"--mysql_config_password=$(DBCONFIG_PASSWORD)"
]