From 6383c4401160839e206b62f7cdba85f1c08cf7e2 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Thu, 14 Nov 2019 09:28:12 +0100 Subject: [VID] Use mariadb galera common chart Instead of using "own" galera chart, reuse chart placed in common part of OOM installation. Will ease move to common galera cluster (which is not done by this commit). Change-Id: I843c89ed4899055e9502268089d0e01f28fe37ae Issue-ID: VID-704 Signed-off-by: Sylvain Desbureaux --- kubernetes/vid/templates/deployment.yaml | 14 ++++++++------ kubernetes/vid/templates/job.yaml | 17 ++++++++--------- kubernetes/vid/templates/secrets.yaml | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 15 deletions(-) (limited to 'kubernetes/vid/templates') diff --git a/kubernetes/vid/templates/deployment.yaml b/kubernetes/vid/templates/deployment.yaml index 9221af7dcf..2c6c5facdc 100644 --- a/kubernetes/vid/templates/deployment.yaml +++ b/kubernetes/vid/templates/deployment.yaml @@ -101,15 +101,18 @@ spec: - name: VID_UEB_URL_LIST value: message-router.{{ include "common.namespace" . }} - name: VID_MYSQL_HOST - value: "{{ .Values.config.vidmysqlhost }}" + value: {{ index .Values "mariadb-galera" "service" "name" }} - name: VID_MYSQL_PORT - value: "{{ .Values.config.vidmysqlport }}" + value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" - name: VID_MYSQL_DBNAME - value: "{{ .Values.config.vidmysqldbname }}" + value: {{ index .Values "mariadb-galera" "config" "mysqlDatabase" }} - name: VID_MYSQL_USER - value: "{{ .Values.config.vidmysqluser }}" + value: {{ index .Values "mariadb-galera" "config" "userName" }} - name: VID_MYSQL_PASS - value: "{{ .Values.config.vidmysqlpassword }}" + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-db + key: db-user-password #valueFrom: # secretKeyRef: {name: {{ include "common.fullname" . }}, key: vid-password} - name: VID_MYSQL_MAXCONNECTIONS @@ -166,4 +169,3 @@ spec: name: {{ include "common.fullname" . }}-log-configmap imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" - diff --git a/kubernetes/vid/templates/job.yaml b/kubernetes/vid/templates/job.yaml index 5214e71130..c2a1858d0c 100644 --- a/kubernetes/vid/templates/job.yaml +++ b/kubernetes/vid/templates/job.yaml @@ -34,11 +34,8 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: - /root/ready.py -{{- $fullname := include "common.fullname" . -}} -{{- range $i,$t := until (int .Values.vid_mariadb_galera.replicaCount)}} - --container-name - - {{ $fullname }}-mariadb-galera-{{$i}} -{{- end }} + - {{ index .Values "mariadb-galera" "service" "name" }} env: - name: NAMESPACE valueFrom: @@ -63,13 +60,16 @@ spec: - /dbcmd-config/db_cmd.sh env: - name: MYSQL_PASSWORD - value: "{{ .Values.config.vidmysqlpassword }}" + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-db + key: db-user-password - name: MYSQL_HOST - value: "{{ .Values.config.vidmysqlhost }}" + value: {{ index .Values "mariadb-galera" "service" "name" }} - name: MYSQL_USER - value: "{{ .Values.config.vidmysqluser }}" + value: {{ index .Values "mariadb-galera" "config" "userName" }} - name: MYSQL_PORT - value: "{{ .Values.config.vidmysqlport }}" + value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" restartPolicy: Never volumes: - name: {{ include "common.fullname" . }}-config @@ -80,4 +80,3 @@ spec: path: db_cmd.sh - key: vid-pre-init.sql path: vid-pre-init.sql - diff --git a/kubernetes/vid/templates/secrets.yaml b/kubernetes/vid/templates/secrets.yaml index 222a3d582a..e0c1992d93 100644 --- a/kubernetes/vid/templates/secrets.yaml +++ b/kubernetes/vid/templates/secrets.yaml @@ -39,3 +39,18 @@ metadata: type: Opaque data: {{ tpl (.Files.Glob "resources/certs/*").AsSecrets . | indent 2 }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }}-db + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + db-user-password: {{ index .Values "mariadb-galera" "config" "userPassword" | b64enc | quote }} + db-root-password: {{ index .Values "mariadb-galera" "config" "mariadbRootPassword" | b64enc | quote }} -- cgit 1.2.3-korg