mirror of
https://github.com/bitnami/charts.git
synced 2026-03-16 06:47:30 +08:00
[bitnami/mongodb] fix: metric and reolicaset script issues with tls and mtls (#21383)
This commit is contained in:
@@ -39,4 +39,4 @@ maintainers:
|
|||||||
name: mongodb
|
name: mongodb
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/bitnami/charts/tree/main/bitnami/mongodb
|
- https://github.com/bitnami/charts/tree/main/bitnami/mongodb
|
||||||
version: 14.4.0
|
version: 14.4.1
|
||||||
|
|||||||
@@ -425,13 +425,19 @@ mongodb: tls.hidden.existingSecrets
|
|||||||
Validate values of MongoDB® exporter URI string - auth.enabled and/or tls.enabled must be enabled or it defaults
|
Validate values of MongoDB® exporter URI string - auth.enabled and/or tls.enabled must be enabled or it defaults
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "mongodb.mongodb_exporter.uri" -}}
|
{{- define "mongodb.mongodb_exporter.uri" -}}
|
||||||
{{- $uriTlsArgs := ternary "tls=true{{if .Values.tls.mTLS.enabled }}&tlsCertificateKeyFile=/certs/mongodb.pem{{ end }}&tlsCAFile=/certs/mongodb-ca-cert" "" .Values.tls.enabled -}}
|
{{- $tlsEnabled := .Values.tls.enabled -}}
|
||||||
{{- if .Values.metrics.username }}
|
{{- $mTlsEnabled := and $tlsEnabled .Values.tls.mTLS.enabled -}}
|
||||||
|
{{- $tlsArgs := "" -}}
|
||||||
|
{{- if $tlsEnabled -}}
|
||||||
|
{{- $tlsCertKeyFile := ternary "&tlsCertificateKeyFile=/certs/mongodb.pem" "" $mTlsEnabled -}}
|
||||||
|
{{- $tlsArgs = printf "tls=true%s&tlsCAFile=/certs/mongodb-ca-cert" $tlsCertKeyFile -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.metrics.username -}}
|
||||||
{{- $uriAuth := ternary "$(echo $MONGODB_METRICS_USERNAME | sed -r \"s/@/%40/g;s/:/%3A/g\"):$(echo $MONGODB_METRICS_PASSWORD | sed -r \"s/@/%40/g;s/:/%3A/g\")@" "" .Values.auth.enabled -}}
|
{{- $uriAuth := ternary "$(echo $MONGODB_METRICS_USERNAME | sed -r \"s/@/%40/g;s/:/%3A/g\"):$(echo $MONGODB_METRICS_PASSWORD | sed -r \"s/@/%40/g;s/:/%3A/g\")@" "" .Values.auth.enabled -}}
|
||||||
{{- printf "mongodb://%slocalhost:%d/admin?%s" $uriAuth (int .Values.containerPorts.mongodb) $uriTlsArgs -}}
|
{{- printf "mongodb://%slocalhost:%d/admin?%s" $uriAuth (int .Values.containerPorts.mongodb) $tlsArgs -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $uriAuth := ternary "$MONGODB_ROOT_USER:$(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:%d/admin?%s" $uriAuth (int .Values.containerPorts.mongodb) $uriTlsArgs -}}
|
{{- printf "mongodb://%slocalhost:%d/admin?%s" $uriAuth (int .Values.containerPorts.mongodb) $tlsArgs -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ data:
|
|||||||
SLEEP_PERIOD=10
|
SLEEP_PERIOD=10
|
||||||
|
|
||||||
{{- if and .Values.auth.enabled .Values.auth.rootPassword }}
|
{{- if and .Values.auth.enabled .Values.auth.rootPassword }}
|
||||||
usernameAndPassword="-u ${MONGODB_ROOT_USER} -p ${MONGODB_ROOT_PASSWORD}"
|
usernameAndPassword="{{- if .Values.tls.enabled}} --tls {{ if .Values.tls.mTLS.enabled }}--tlsCertificateKeyFile=/certs/mongodb.pem {{ end }}--tlsCAFile=/certs/mongodb-ca-cert{{- end }} -u ${MONGODB_ROOT_USER} -p ${MONGODB_ROOT_PASSWORD}"
|
||||||
{{- else }}
|
{{- else }}
|
||||||
usernameAndPassword=""
|
usernameAndPassword=""
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user