diff options
author | RPMishra <rpmishra@aarnanetworks.com> | 2020-10-07 12:09:01 +0530 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-11-18 08:08:36 +0000 |
commit | e4ee7f1be369215e609930f5a885bd04cbe4534d (patch) | |
tree | ed60bbc662d22e848654dfe115d6100d7c4a33b9 /kubernetes/vid/templates | |
parent | c25f743b482e180c6b6d0798b5f99c9708130f9b (diff) |
[COMMON/VID] Modified VID to use Shared DB.
This change modifies VID to use the shared DB instance of mariadb.
In addition, we create a mechanism in mariadb-init to allow a shared DB
user to run a script after the DB has been created.
The script can be passed as a configMap (as is the case with VID) or it
can be a standalone script that is passed as a string.
Issue-ID: OOM-1226
Change-Id: Ie51823338562a6fbe7472025d62cd4dba688168d
Signed-off-by: RPMishra <rpmishra@aarnanetworks.com>
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Diffstat (limited to 'kubernetes/vid/templates')
-rw-r--r-- | kubernetes/vid/templates/configmap.yaml | 4 | ||||
-rw-r--r-- | kubernetes/vid/templates/deployment.yaml | 6 | ||||
-rw-r--r-- | kubernetes/vid/templates/job.yaml | 82 |
3 files changed, 5 insertions, 87 deletions
diff --git a/kubernetes/vid/templates/configmap.yaml b/kubernetes/vid/templates/configmap.yaml index b1509a95ad..0ba466dfb9 100644 --- a/kubernetes/vid/templates/configmap.yaml +++ b/kubernetes/vid/templates/configmap.yaml @@ -43,7 +43,7 @@ data: apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "common.fullname" . }} + name: {{ include "common.fullname" . }}-db-init namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} @@ -51,4 +51,4 @@ metadata: release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: -{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
\ No newline at end of file +{{ tpl (.Files.Glob "resources/config/db_cmd.sh").AsConfig . | indent 2 }} diff --git a/kubernetes/vid/templates/deployment.yaml b/kubernetes/vid/templates/deployment.yaml index 5423febaf5..41b0019cbe 100644 --- a/kubernetes/vid/templates/deployment.yaml +++ b/kubernetes/vid/templates/deployment.yaml @@ -41,7 +41,7 @@ spec: - /app/ready.py args: - --job-name - - {{ include "common.fullname" . }}-galera-config + - {{ include "common.fullname" . }}-mariadb-init-config-job env: - name: NAMESPACE valueFrom: @@ -105,9 +105,9 @@ spec: - name: VID_UEB_URL_LIST value: message-router.{{ include "common.namespace" . }} - name: VID_MYSQL_HOST - value: {{ index .Values "mariadb-galera" "service" "name" }} + value: {{ include "common.mariadbService" . }} - name: VID_MYSQL_PORT - value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" + value: "{{ include "common.mariadbPort" . }}" - name: VID_MYSQL_DBNAME value: {{ index .Values "mariadb-galera" "config" "mysqlDatabase" }} - name: VID_MYSQL_USER diff --git a/kubernetes/vid/templates/job.yaml b/kubernetes/vid/templates/job.yaml deleted file mode 100644 index b051cdec36..0000000000 --- a/kubernetes/vid/templates/job.yaml +++ /dev/null @@ -1,82 +0,0 @@ -{{/* -# Copyright © 2018 Amdocs, Bell Canada -# Copyright © 2020 Samsung Electronics -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -*/}} - -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ include "common.fullname" . }}-galera-config - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }}-job - release: {{ include "common.release" . }} -spec: - template: - metadata: - labels: - app: {{ include "common.name" . }}-job - release: {{ include "common.release" . }} - spec: - initContainers: -#This container checks that all galera instances are up before initializing it. - - name: {{ include "common.name" . }}-readiness - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - command: - - /app/ready.py - - --container-name - - {{ index .Values "mariadb-galera" "service" "name" }} - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - containers: - - name: {{ include "common.name" . }}-job - image: {{ .Values.mariadb_image }} - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - volumeMounts: - - mountPath: /dbcmd-config/db_cmd.sh - name: {{ include "common.fullname" . }}-config - subPath: db_cmd.sh - - mountPath: /db-config/vid-pre-init.sql - name: {{ include "common.fullname" . }}-config - subPath: vid-pre-init.sql - command: - - /bin/sh - args: - - -x - - /dbcmd-config/db_cmd.sh - env: - - name: MYSQL_PASSWORD - {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 10 }} - - name: MYSQL_HOST - value: {{ index .Values "mariadb-galera" "service" "name" }} - - name: MYSQL_USER - {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 10 }} - - name: MYSQL_PORT - value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" - restartPolicy: Never - volumes: - - name: {{ include "common.fullname" . }}-config - configMap: - name: {{ include "common.fullname" . }} - items: - - key: db_cmd.sh - path: db_cmd.sh - - key: vid-pre-init.sql - path: vid-pre-init.sql |