From 04ac9216fa1d6ec1078be00b066cf650bd771e15 Mon Sep 17 00:00:00 2001 From: tetianakravchenko Date: Sat, 15 Dec 2018 18:08:28 +0100 Subject: [PATCH] [mongodb-replicaset] replace MONGODB_URL with --mongodb.uri (#10026) * replace MONGODB_URL with --mongodb.uri; minor test fixes Signed-off-by: Tetiana Kravchenko * remove admin database for auth Signed-off-by: Tetiana Kravchenko * replace MONGODB_URL to -mongodb.uri in livenessProbe Signed-off-by: Tetiana Kravchenko --- stable/mongodb-replicaset/Chart.yaml | 2 +- .../templates/mongodb-statefulset.yaml | 20 +++++++++---------- .../tests/mongodb-up-test.sh | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/stable/mongodb-replicaset/Chart.yaml b/stable/mongodb-replicaset/Chart.yaml index 2bcd5ee1a8..58ee74543b 100644 --- a/stable/mongodb-replicaset/Chart.yaml +++ b/stable/mongodb-replicaset/Chart.yaml @@ -1,6 +1,6 @@ name: mongodb-replicaset home: https://github.com/mongodb/mongo -version: 3.8.5 +version: 3.8.6 appVersion: 3.6 description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications. diff --git a/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml b/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml index 63ee52980e..0952334ab9 100644 --- a/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml +++ b/stable/mongodb-replicaset/templates/mongodb-statefulset.yaml @@ -229,12 +229,12 @@ spec: - sh - -ec - >- - {{- if .Values.auth.enabled }} - export MONGODB_URL=mongodb://$METRICS_USER:$METRICS_PASSWORD@localhost:{{ .Values.port }}; - {{- else }} - export MONGODB_URL=mongodb://localhost:{{ .Values.port }}; - {{- end }} /bin/mongodb_exporter + {{- if .Values.auth.enabled }} + -mongodb.uri mongodb://$METRICS_USER:$METRICS_PASSWORD@localhost:{{ .Values.port }} + {{- else }} + -mongodb.uri mongodb://localhost:{{ .Values.port }} + {{- end }} {{- if .Values.tls.enabled }} -mongodb.tls -mongodb.tls-ca=/ca/tls.crt @@ -277,12 +277,12 @@ spec: - sh - -ec - >- - {{- if .Values.auth.enabled }} - export MONGODB_URL=mongodb://$METRICS_USER:$METRICS_PASSWORD@localhost:{{ .Values.port }}; - {{- else }} - export MONGODB_URL=mongodb://localhost:{{ .Values.port }}; - {{- end }} /bin/mongodb_exporter + {{- if .Values.auth.enabled }} + -mongodb.uri mongodb://$METRICS_USER:$METRICS_PASSWORD@localhost:{{ .Values.port }} + {{- else }} + -mongodb.uri mongodb://localhost:{{ .Values.port }} + {{- end }} {{- if .Values.tls.enabled }} -mongodb.tls -mongodb.tls-ca=/ca/tls.crt diff --git a/stable/mongodb-replicaset/tests/mongodb-up-test.sh b/stable/mongodb-replicaset/tests/mongodb-up-test.sh index 39e64218c8..c43bad2d59 100644 --- a/stable/mongodb-replicaset/tests/mongodb-up-test.sh +++ b/stable/mongodb-replicaset/tests/mongodb-up-test.sh @@ -26,7 +26,7 @@ replicas() { master_pod() { for ((i = 0; i < $(replicas); ++i)); do response=$(mongo $MONGOARGS "--host=$(pod_name "$i")" "--eval=rs.isMaster().ismaster") - if [[ "$response" =~ "true" ]]; then + if [[ "$response" == "true" ]]; then pod_name "$i" break fi @@ -64,7 +64,7 @@ setup() { @test "Write key to primary" { response=$(mongo $MONGOARGS --host=$(master_pod) "--eval=db.test.insert({\"abc\": \"def\"}).nInserted") - if [[ ! "$response" =~ "1" ]]; then + if [[ ! "$response" -eq 1 ]]; then exit 1 fi }