1 # Copyright © 2017 Amdocs, Bell Canada
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 {{- if .Values.global.migration.enabled }}
18 name: {{ include "common.fullname" . }}-backup
19 namespace: {{ include "common.namespace" . }}
21 app: {{ include "common.name" . }}
22 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23 release: {{ include "common.release" . }}
24 heritage: {{ .Release.Service }}
26 "helm.sh/hook": pre-upgrade,pre-install
27 "helm.sh/hook-weight": "1"
28 "helm.sh/hook-delete-policy": before-hook-creation
34 app: {{ include "common.name" . }}
35 release: {{ include "common.release" . }}
36 name: {{ include "common.name" . }}
39 - name: {{ include "common.fullname" . }}
40 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
41 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44 value: {{ .Values.global.migration.dbHost }}
46 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "login") | indent 10 }}
48 value: "{{ .Values.global.migration.dbPort }}"
50 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "password") | indent 10 }}
54 - 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
56 - mountPath: /etc/localtime
59 - name: backup-storage
60 mountPath: /var/data/mariadb
65 - name: backup-storage
66 persistentVolumeClaim:
67 claimName: {{ include "common.fullname" . }}-migration
69 - name: "{{ include "common.namespace" . }}-docker-registry-key"
76 name: {{ include "common.fullname" . }}-config-job
77 namespace: {{ include "common.namespace" . }}
79 app: {{ include "common.name" . }}
80 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
81 release: {{ include "common.release" . }}
82 heritage: {{ .Release.Service }}
84 "helm.sh/hook": post-upgrade,post-rollback,post-install
85 "helm.sh/hook-weight": "0"
86 "helm.sh/hook-delete-policy": before-hook-creation
92 app: {{ include "common.name" . }}-job
93 release: {{ include "common.release" . }}
94 name: {{ include "common.name" . }}
97 - name: {{ include "common.name" . }}-readiness
102 - {{ .Values.global.mariadbGalera.nameOverride }}
108 fieldPath: metadata.namespace
109 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
110 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
112 - name: {{ include "common.name" . }}
113 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
114 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
119 mysql() { /usr/bin/mysql -h ${DB_HOST} -P ${DB_PORT} "$@"; };
121 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 }};
122 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;
123 {{- if .Values.global.migration.enabled }}
124 mysql -vv --user=root --password=${MYSQL_ROOT_PASSWORD} < `ls -tr /var/data/mariadb/* | tail -1`;
130 name: {{ include "common.release" . }}-so-db-secrets
131 key: mariadb.readwrite.host
135 name: {{ include "common.release" . }}-so-db-secrets
136 key: mariadb.readwrite.port
137 - name: MYSQL_ROOT_PASSWORD
138 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 10 }}
140 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
142 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
144 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
145 - name: DB_ADMIN_PASSWORD
146 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
147 - name: CAMUNDA_DB_USER
148 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "login") | indent 10 }}
149 - name: CAMUNDA_DB_PASSWORD
150 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "password") | indent 10 }}
151 - name: REQUEST_DB_USER
152 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "login") | indent 10 }}
153 - name: REQUEST_DB_PASSWORD
154 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "password") | indent 10 }}
155 - name: CATALOG_DB_USER
156 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "login") | indent 10 }}
157 - name: CATALOG_DB_PASSWORD
158 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "password") | indent 10 }}
160 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nfvo-db-creds" "key" "login") | indent 10 }}
161 - name: NFVO_DB_PASSWORD
162 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nfvo-db-creds" "key" "password") | indent 10 }}
164 - mountPath: /etc/localtime
167 - name: docker-entrypoint-initdb-d-sh
168 mountPath: "/docker-entrypoint-initdb.d"
169 - name: docker-entrypoint-initdb-d-sql
170 mountPath: "/docker-entrypoint-initdb.d/db-sql-scripts"
171 {{- if .Values.global.migration.enabled }}
172 - name: backup-storage
173 mountPath: /var/data/mariadb
176 {{ include "common.resources" . | indent 12 }}
177 {{- if .Values.nodeSelector }}
179 {{ toYaml .Values.nodeSelector | indent 10 }}
181 {{- if .Values.affinity }}
183 {{ toYaml .Values.affinity | indent 10 }}
189 - name: docker-entrypoint-initdb-d-sh
191 name: {{ include "common.fullname" . }}-mariadb-sh
192 - name: docker-entrypoint-initdb-d-sql
194 name: {{ include "common.fullname" . }}-mariadb-sql
195 {{- if .Values.global.migration.enabled }}
196 - name: backup-storage
197 persistentVolumeClaim:
198 claimName: {{ include "common.fullname" . }}-migration
202 - name: "{{ include "common.namespace" . }}-docker-registry-key"