blob: 132ac27ea23e0dcdd2883d95953714830921dd59 [file] [log] [blame]
tringuyeneb9eb592020-04-01 17:51:06 +00001#!/bin/bash
2
3TEMP_POD=$(kubectl get pod -n $NAMESPACE_ENV --selector \
4 app='{{ include "common.fullname" . }}' -o \
5 jsonpath='{.items[?(@.metadata.ownerReferences[].kind=="ReplicaSet")].metadata.name}')
6
7tmp_MYSQL_PASSWORD=$(echo -n $(kubectl exec -n $NAMESPACE_ENV $TEMP_POD -- printenv \
8 MYSQL_PASSWORD) | base64)
9
10tmp_ROOT_PASSWORD=$(echo -n $(kubectl exec -n $NAMESPACE_ENV $TEMP_POD -- printenv \
11 MYSQL_ROOT_PASSWORD) | base64)
12
13FLAG_EX_ROOT_SEC='{{ include "common.secret.getSecretNameFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .)) }}'
14
15FLAG_EX_SEC='{{ include "common.secret.getSecretNameFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .)) }}'
16
17kubectl patch secret $FLAG_EX_ROOT_SEC -p \
18 '{"data":{"password":"'"$tmp_ROOT_PASSWORD"'"}}'
19
20kubectl patch secret $FLAG_EX_SEC -p \
21 '{"data":{"password":"'"$tmp_MYSQL_PASSWORD"'"}}'
22
23kubectl delete pod -n $NAMESPACE_ENV {{ include "common.fullname" . }}-0 --now
24kubectl delete deployment -n $NAMESPACE_ENV {{ include "common.fullname" . }}-upgrade-deployment
25kubectl delete secret -n $NAMESPACE_ENV {{ include "common.fullname" . }}-temp-upgrade-root
26kubectl delete secret -n $NAMESPACE_ENV {{ include "common.fullname" . }}-temp-upgrade-usercred