From e91cda71ae76af150bb3876465e386afb8ec82b1 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Wed, 3 May 2017 20:02:47 +0530 Subject: [PATCH] mariadb-cluster: generate random password for standard user --- .../mariadb-cluster/templates/master-deployment.yaml | 2 ++ incubator/mariadb-cluster/templates/secrets.yaml | 8 +++++++- incubator/mariadb-cluster/templates/slave-deployment.yaml | 2 ++ incubator/mariadb-cluster/values.yaml | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/incubator/mariadb-cluster/templates/master-deployment.yaml b/incubator/mariadb-cluster/templates/master-deployment.yaml index 67405bfa8..0db841529 100644 --- a/incubator/mariadb-cluster/templates/master-deployment.yaml +++ b/incubator/mariadb-cluster/templates/master-deployment.yaml @@ -24,6 +24,7 @@ spec: secretKeyRef: name: {{ template "fullname" . }} key: mariadb-root-password + {{- if .Values.mariadbUser }} - name: MARIADB_USER value: {{ default "" .Values.mariadbUser | quote }} - name: MARIADB_PASSWORD @@ -31,6 +32,7 @@ spec: secretKeyRef: name: {{ template "fullname" . }} key: mariadb-password + {{- end }} - name: MARIADB_DATABASE value: {{ default "" .Values.mariadbDatabase | quote }} - name: MARIADB_REPLICATION_MODE diff --git a/incubator/mariadb-cluster/templates/secrets.yaml b/incubator/mariadb-cluster/templates/secrets.yaml index e195571da..05f09a0fb 100644 --- a/incubator/mariadb-cluster/templates/secrets.yaml +++ b/incubator/mariadb-cluster/templates/secrets.yaml @@ -14,7 +14,13 @@ data: {{ else }} mariadb-root-password: {{ randAlphaNum 10 | b64enc | quote }} {{ end }} - mariadb-password: {{ default "" .Values.mariadbPassword | b64enc | quote }} + {{ if .Values.mariadbUser }} + {{ if .Values.mariadbPassword }} + mariadb-password: {{ .Values.mariadbPassword | b64enc | quote }} + {{ else }} + mariadb-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + {{ end }} {{ if .Values.mariadbReplicationPassword }} mariadb-replication-password: {{ .Values.mariadbReplicationPassword | b64enc | quote }} {{ else }} diff --git a/incubator/mariadb-cluster/templates/slave-deployment.yaml b/incubator/mariadb-cluster/templates/slave-deployment.yaml index 074d836dd..de1ee81d5 100644 --- a/incubator/mariadb-cluster/templates/slave-deployment.yaml +++ b/incubator/mariadb-cluster/templates/slave-deployment.yaml @@ -24,6 +24,7 @@ spec: secretKeyRef: name: {{ template "fullname" . }} key: mariadb-root-password + {{- if .Values.mariadbUser }} - name: MARIADB_USER value: {{ default "" .Values.mariadbUser | quote }} - name: MARIADB_PASSWORD @@ -31,6 +32,7 @@ spec: secretKeyRef: name: {{ template "fullname" . }} key: mariadb-password + {{- end }} - name: MARIADB_DATABASE value: {{ default "" .Values.mariadbDatabase | quote }} - name: MARIADB_REPLICATION_MODE diff --git a/incubator/mariadb-cluster/values.yaml b/incubator/mariadb-cluster/values.yaml index 3428e5278..7b733b3b6 100644 --- a/incubator/mariadb-cluster/values.yaml +++ b/incubator/mariadb-cluster/values.yaml @@ -31,7 +31,7 @@ replicasCount: 3 ## Database to create ## ref: https://github.com/bitnami/bitnami-docker-mariadb#creating-a-database-on-first-run ## -mariadbDatabase: my-database +mariadbDatabase: my_database ## MariaDB replication user ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-up-a-replication-cluster