mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-09 05:06:29 +10:00
[bitnami/mongodb] Configurable admin/root user name (#7229)
* Configurable admin/root user name * Adjust exporter uri * Update bitnami/mongodb/values.yaml Co-authored-by: Juan Ariza Toledano <juanariza@vmware.com> * Adding readme metadata Co-authored-by: Juan Ariza Toledano <juanariza@vmware.com>
This commit is contained in:
co-authored by
Juan Ariza Toledano
parent
7ca2a4bb91
commit
d7ef3be579
@@ -26,4 +26,4 @@ name: mongodb
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-mongodb
|
||||
- https://mongodb.org
|
||||
version: 10.25.2
|
||||
version: 10.26.0
|
||||
|
||||
@@ -97,6 +97,7 @@ Refer to the [chart documentation for more information on each of these architec
|
||||
| `architecture` | MongoDB® architecture (`standalone` or `replicaset`) | `standalone` |
|
||||
| `useStatefulSet` | Set to true to use a StatefulSet instead of a Deployment (only when `architecture=standalone`) | `false` |
|
||||
| `auth.enabled` | Enable authentication | `true` |
|
||||
| `auth.rootUser` | MongoDB® root user | `root` |
|
||||
| `auth.rootPassword` | MongoDB® root password | `""` |
|
||||
| `auth.username` | MongoDB® custom user (mandatory if `auth.database` is set) | `""` |
|
||||
| `auth.password` | MongoDB® custom user password | `""` |
|
||||
|
||||
@@ -346,7 +346,7 @@ Validate values of MongoDB® exporter URI string - auth.enabled and/or tls.en
|
||||
*/}}
|
||||
{{- define "mongodb.mongodb_exporter.uri" -}}
|
||||
{{- $uriTlsArgs := ternary "tls=true&tlsCertificateKeyFile=/certs/mongodb.pem&tlsCAFile=/certs/mongodb-ca-cert" "" .Values.tls.enabled -}}
|
||||
{{- $uriAuth := ternary "root:$(echo $MONGODB_ROOT_PASSWORD | sed -r \"s/@/%40/g;s/:/%3A/g\")@" "" .Values.auth.enabled -}}
|
||||
{{- $uriAuth := ternary "$MONGODB_ROOT_USER:$(echo $MONGODB_ROOT_PASSWORD | sed -r \"s/@/%40/g;s/:/%3A/g\")@" "" .Values.auth.enabled -}}
|
||||
|
||||
{{- printf "mongodb://%slocalhost:27017/admin?%s" $uriAuth $uriTlsArgs -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -166,6 +166,8 @@ spec:
|
||||
- name: MONGODB_ADVERTISED_HOSTNAME
|
||||
value: "$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.{{ .Values.clusterDomain }}"
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
||||
@@ -401,6 +401,8 @@ spec:
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: MONGODB_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
||||
@@ -87,6 +87,7 @@ data:
|
||||
else
|
||||
echo "Pod name doesn't match initial primary pod name, configuring node as a secondary"
|
||||
export MONGODB_REPLICA_SET_MODE="secondary"
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_USER="$MONGODB_ROOT_USER"
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD="$MONGODB_ROOT_PASSWORD"
|
||||
export MONGODB_INITIAL_PRIMARY_PORT_NUMBER="$MONGODB_PORT_NUMBER"
|
||||
export MONGODB_ROOT_PASSWORD="" MONGODB_USERNAME="" MONGODB_DATABASE="" MONGODB_PASSWORD=""
|
||||
@@ -118,6 +119,7 @@ data:
|
||||
echo "Advertised Hostname: $MONGODB_ADVERTISED_HOSTNAME"
|
||||
echo "Configuring node as a hidden node"
|
||||
export MONGODB_REPLICA_SET_MODE="hidden"
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_USER="$MONGODB_ROOT_USER"
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD="$MONGODB_ROOT_PASSWORD"
|
||||
export MONGODB_INITIAL_PRIMARY_PORT_NUMBER="$MONGODB_PORT_NUMBER"
|
||||
export MONGODB_ROOT_PASSWORD="" MONGODB_USERNAME="" MONGODB_DATABASE="" MONGODB_PASSWORD=""
|
||||
|
||||
@@ -257,6 +257,8 @@ spec:
|
||||
name: {{ include "mongodb.secretName" . }}
|
||||
key: mongodb-password
|
||||
{{- end }}
|
||||
- name: MONGODB_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
@@ -435,6 +437,8 @@ spec:
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: MONGODB_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
||||
@@ -211,6 +211,8 @@ spec:
|
||||
name: {{ include "mongodb.secretName" . }}
|
||||
key: mongodb-password
|
||||
{{- end }}
|
||||
- name: MONGODB_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
@@ -373,6 +375,8 @@ spec:
|
||||
/bin/mongodb_exporter --web.listen-address ":{{ .Values.metrics.containerPort }}" --mongodb.uri "{{ include "mongodb.mongodb_exporter.uri" . }}" {{ .Values.metrics.extraFlags }}
|
||||
env:
|
||||
{{- if .Values.auth.enabled }}
|
||||
- name: MONGODB_ROOT_USER
|
||||
value: {{ .Values.auth.rootUser | quote }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
"title": "Enable Authentication",
|
||||
"form": true
|
||||
},
|
||||
"rootUser": {
|
||||
"type": "string",
|
||||
"title": "MongoDB® admin user",
|
||||
"form": true,
|
||||
"description": "Name of the admin user. Default is root"
|
||||
},
|
||||
"rootPassword": {
|
||||
"type": "string",
|
||||
"title": "MongoDB® admin password",
|
||||
|
||||
@@ -133,6 +133,9 @@ auth:
|
||||
## ref: https://docs.mongodb.com/manual/tutorial/enable-authentication/
|
||||
##
|
||||
enabled: true
|
||||
## @param auth.rootUser MongoDB® root user
|
||||
##
|
||||
rootUser: root
|
||||
## @param auth.rootPassword MongoDB® root password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user