2 # Copyright © 2017 Amdocs, Bell Canada
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 {{- if .Values.global.migration.enabled }}
20 name: {{ include "common.fullname" . }}-backup
21 namespace: {{ include "common.namespace" . }}
23 app: {{ include "common.name" . }}
24 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25 release: {{ include "common.release" . }}
26 heritage: {{ .Release.Service }}
28 "helm.sh/hook": pre-upgrade,pre-install
29 "helm.sh/hook-weight": "1"
30 "helm.sh/hook-delete-policy": before-hook-creation
36 app: {{ include "common.name" . }}
37 release: {{ include "common.release" . }}
38 name: {{ include "common.name" . }}
41 - name: {{ include "common.fullname" . }}
42 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
43 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46 value: {{ .Values.global.migration.dbHost }}
48 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "login") | indent 10 }}
50 value: "{{ .Values.global.migration.dbPort }}"
52 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "password") | indent 10 }}
56 - mysqldump -vv --user=${DB_USER} --password=${DB_PASS} --host=${DB_HOST} --port=${DB_PORT} --databases --single-transaction --quick --lock-tables=false catalogdb requestdb nfvo > /var/data/mariadb/backup-`date +%s`.sql
58 - mountPath: /etc/localtime
61 - name: backup-storage
62 mountPath: /var/data/mariadb
67 - name: backup-storage
68 persistentVolumeClaim:
69 claimName: {{ include "common.fullname" . }}-migration
71 - name: "{{ include "common.namespace" . }}-docker-registry-key"
78 name: {{ include "common.fullname" . }}-config-job
79 namespace: {{ include "common.namespace" . }}
81 app: {{ include "common.name" . }}
82 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
83 release: {{ include "common.release" . }}
84 heritage: {{ .Release.Service }}
86 "helm.sh/hook": post-upgrade,post-rollback,post-install
87 "helm.sh/hook-weight": "0"
88 "helm.sh/hook-delete-policy": before-hook-creation
94 app: {{ include "common.name" . }}-job
95 release: {{ include "common.release" . }}
96 name: {{ include "common.name" . }}
99 - name: {{ include "common.name" . }}-readiness
104 - {{ .Values.global.mariadbGalera.nameOverride }}
110 fieldPath: metadata.namespace
111 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
112 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
114 - name: {{ include "common.name" . }}
115 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
116 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121 mysql() { /usr/bin/mysql -h ${DB_HOST} -P ${DB_PORT} "$@"; };
123 mysql --user=root --password=${MYSQL_ROOT_PASSWORD} requestdb -e exit > /dev/null 2>&1 {{ if not .Values.global.migration.enabled }} && echo "Database already initialized!!!" && exit 0 {{ end }};
124 for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; *) echo "$0: ignoring $f" ;; esac; echo; done;
125 {{- if .Values.global.migration.enabled }}
126 mysql -vv --user=root --password=${MYSQL_ROOT_PASSWORD} < `ls -tr /var/data/mariadb/* | tail -1`;
132 name: {{ include "common.release" . }}-so-db-secrets
133 key: mariadb.readwrite.host
137 name: {{ include "common.release" . }}-so-db-secrets
138 key: mariadb.readwrite.port
139 - name: MYSQL_ROOT_PASSWORD
140 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 10 }}
142 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
144 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
146 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
147 - name: DB_ADMIN_PASSWORD
148 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
149 - name: CAMUNDA_DB_USER
150 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "login") | indent 10 }}
151 - name: CAMUNDA_DB_PASSWORD
152 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "password") | indent 10 }}
153 - name: REQUEST_DB_USER
154 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "login") | indent 10 }}
155 - name: REQUEST_DB_PASSWORD
156 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "password") | indent 10 }}
157 - name: CATALOG_DB_USER
158 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "login") | indent 10 }}
159 - name: CATALOG_DB_PASSWORD
160 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "password") | indent 10 }}
162 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nfvo-db-creds" "key" "login") | indent 10 }}
163 - name: NFVO_DB_PASSWORD
164 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nfvo-db-creds" "key" "password") | indent 10 }}
166 - mountPath: /etc/localtime
169 - name: docker-entrypoint-initdb-d-sh
170 mountPath: "/docker-entrypoint-initdb.d"
171 - name: docker-entrypoint-initdb-d-sql
172 mountPath: "/docker-entrypoint-initdb.d/db-sql-scripts"
173 {{- if .Values.global.migration.enabled }}
174 - name: backup-storage
175 mountPath: /var/data/mariadb
178 {{ include "common.resources" . | indent 12 }}
179 {{- if .Values.nodeSelector }}
181 {{ toYaml .Values.nodeSelector | indent 10 }}
183 {{- if .Values.affinity }}
185 {{ toYaml .Values.affinity | indent 10 }}
191 - name: docker-entrypoint-initdb-d-sh
193 name: {{ include "common.fullname" . }}-mariadb-sh
194 - name: docker-entrypoint-initdb-d-sql
196 name: {{ include "common.fullname" . }}-mariadb-sql
197 {{- if .Values.global.migration.enabled }}
198 - name: backup-storage
199 persistentVolumeClaim:
200 claimName: {{ include "common.fullname" . }}-migration
204 - name: "{{ include "common.namespace" . }}-docker-registry-key"