Mariadb: Support changing the root password
This PS udpates the mariadb chart to support changing the root password. Additionally it moves to use three replicas in the gate Change-Id: I286ad0b892e5ea2f85636a0c7af58598bcfdaec4 Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
parent
0b44116506
commit
a8fe949612
@ -246,7 +246,8 @@ def mysqld_bootstrap():
|
|||||||
"GRANT ALL ON *.* TO '{0}'@'%' WITH GRANT OPTION ;\n"
|
"GRANT ALL ON *.* TO '{0}'@'%' WITH GRANT OPTION ;\n"
|
||||||
"DROP DATABASE IF EXISTS test ;\n"
|
"DROP DATABASE IF EXISTS test ;\n"
|
||||||
"FLUSH PRIVILEGES ;\n"
|
"FLUSH PRIVILEGES ;\n"
|
||||||
"SHUTDOWN ;".format(mysql_dbadmin_username, mysql_dbadmin_password))
|
"SHUTDOWN ;".format(mysql_dbadmin_username,
|
||||||
|
mysql_dbadmin_password))
|
||||||
bootstrap_sql_file = tempfile.NamedTemporaryFile(suffix='.sql').name
|
bootstrap_sql_file = tempfile.NamedTemporaryFile(suffix='.sql').name
|
||||||
with open(bootstrap_sql_file, 'w') as f:
|
with open(bootstrap_sql_file, 'w') as f:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
@ -680,6 +681,22 @@ def run_mysqld(cluster='existing'):
|
|||||||
'--defaults-file=/etc/mysql/admin_user.cnf'
|
'--defaults-file=/etc/mysql/admin_user.cnf'
|
||||||
], logger)
|
], logger)
|
||||||
|
|
||||||
|
logger.info("Setting the root password to the current value")
|
||||||
|
template = ("CREATE OR REPLACE USER '{0}'@'%' IDENTIFIED BY \'{1}\' ;\n"
|
||||||
|
"GRANT ALL ON *.* TO '{0}'@'%' WITH GRANT OPTION ;\n"
|
||||||
|
"FLUSH PRIVILEGES ;\n"
|
||||||
|
"SHUTDOWN ;".format(mysql_dbadmin_username,
|
||||||
|
mysql_dbadmin_password))
|
||||||
|
bootstrap_sql_file = tempfile.NamedTemporaryFile(suffix='.sql').name
|
||||||
|
with open(bootstrap_sql_file, 'w') as f:
|
||||||
|
f.write(template)
|
||||||
|
f.close()
|
||||||
|
run_cmd_with_logging([
|
||||||
|
'mysqld', '--bind-address=127.0.0.1',
|
||||||
|
"--init-file={0}".format(bootstrap_sql_file)
|
||||||
|
], logger)
|
||||||
|
os.remove(bootstrap_sql_file)
|
||||||
|
|
||||||
run_cmd_with_logging(mysqld_cmd, logger)
|
run_cmd_with_logging(mysqld_cmd, logger)
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ metadata:
|
|||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
||||||
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
|
mariadb-dbadmin-password-hash: {{ tuple "secret-dbadmin-password.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
{{ tuple $envAll "mariadb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -23,7 +23,6 @@ make mariadb
|
|||||||
: ${OSH_INFRA_EXTRA_HELM_ARGS:=""}
|
: ${OSH_INFRA_EXTRA_HELM_ARGS:=""}
|
||||||
helm upgrade --install mariadb ./mariadb \
|
helm upgrade --install mariadb ./mariadb \
|
||||||
--namespace=openstack \
|
--namespace=openstack \
|
||||||
--set pod.replicas.server=1 \
|
|
||||||
${OSH_INFRA_EXTRA_HELM_ARGS} \
|
${OSH_INFRA_EXTRA_HELM_ARGS} \
|
||||||
${OSH_INFRA_EXTRA_HELM_ARGS_MARIADB}
|
${OSH_INFRA_EXTRA_HELM_ARGS_MARIADB}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user