[bitnami/mongodb] Ensuring the .Values.auth.rootUser is used everywhere (#16849)

* Ensuring that if a custom root user name is configured it is used throughout the chart

Signed-off-by: Douglas Thomson <djt210@gmail.com>

* Removing extra dollar sign

Signed-off-by: Douglas Thomson <djt210@gmail.com>

---------

Signed-off-by: Douglas Thomson <djt210@gmail.com>
Signed-off-by: Douglas Thomson <36892985+dtrts@users.noreply.github.com>
This commit is contained in:
Douglas Thomson
2023-05-22 10:34:12 +01:00
committed by GitHub
parent 5c2b7b9a6f
commit 99ebd2b762
4 changed files with 7 additions and 7 deletions

View File

@@ -25,4 +25,4 @@ maintainers:
name: mongodb
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/mongodb
version: 13.14.0
version: 13.14.1

View File

@@ -117,9 +117,9 @@ To connect to your database, create a MongoDB&reg; client container:
Then, run the following command:
{{- if eq .Values.architecture "replicaset" }}
mongosh admin --host "{{ join "," $mongoList }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD{{- end }}
mongosh admin --host "{{ join "," $mongoList }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u $MONGODB_ROOT_USER -p $MONGODB_ROOT_PASSWORD{{- end }}
{{- else }}
mongosh admin --host "{{ template "mongodb.service.nameOverride" . }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD{{- end }}
mongosh admin --host "{{ template "mongodb.service.nameOverride" . }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u $MONGODB_ROOT_USER -p $MONGODB_ROOT_PASSWORD{{- end }}
{{- end }}
{{- if and (eq .Values.architecture "replicaset") .Values.externalAccess.enabled }}

View File

@@ -116,7 +116,7 @@ data:
{{- range $e, $i := until $replicaCount }}
{{- $mongoList = append $mongoList (printf "%s-%d.%s-headless.%s.svc.%s:%d" $fullname $i $fullname $releaseNamespace $clusterDomain $portNumber) }}
{{- end }}
current_primary=$(mongosh admin --host "{{ join "," $mongoList }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD{{- end }}{{- if .Values.tls.enabled}} --tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert{{- end }} --eval 'db.runCommand("ismaster")' | awk -F\' '/primary/ {print $2}')
current_primary=$(mongosh admin --host "{{ join "," $mongoList }}" {{- if .Values.auth.enabled }} --authenticationDatabase admin -u $MONGODB_ROOT_USER -p $MONGODB_ROOT_PASSWORD{{- end }}{{- if .Values.tls.enabled}} --tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert{{- end }} --eval 'db.runCommand("ismaster")' | awk -F\' '/primary/ {print $2}')
if ! is_empty_value "$current_primary"; then
info "Detected existing primary: ${current_primary}"
@@ -219,7 +219,7 @@ data:
SLEEP_PERIOD=10
{{- if and .Values.auth.enabled .Values.auth.rootPassword }}
usernameAndPassword="-u root -p ${MONGODB_ROOT_PASSWORD}"
usernameAndPassword="-u ${$MONGODB_ROOT_USER} -p ${MONGODB_ROOT_PASSWORD}"
{{- else }}
usernameAndPassword=""
{{- end }}

View File

@@ -90,10 +90,10 @@ data:
type: {{ print "mongodb" | b64enc | quote }}
host: {{ print $host | b64enc | quote }}
port: {{ print $port | b64enc | quote }}
username: {{ print "root" | b64enc | quote }}
username: {{ print .Values.auth.rootUser | b64enc | quote }}
password: {{ print $rootPassword | b64enc | quote }}
database: {{ print "admin" | b64enc | quote }}
uri: {{ printf "mongodb://root:%s@%s/admin" $rootPassword $hostForURI | b64enc | quote }}
uri: {{ printf "mongodb://%s:%s@%s/admin" .Values.auth.rootUser $rootPassword $hostForURI | b64enc | quote }}
{{- range $e, $i := until (len $customUsersList) }}
---
apiVersion: v1