Skip to content

Commit cbbf1fb

Browse files
ssalauesJnig
authored andcommitted
fix: mongo init issues (helm#7772)
This fixes issues where the init container will stay up indefinitely because the running 'mongod' process cannot join the replicaset Signed-off-by: Salim <[email protected]> Signed-off-by: Jakob Niggel <[email protected]>
1 parent 0bef58a commit cbbf1fb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

stable/mongodb-replicaset/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mongodb-replicaset
22
home: https://github.com/mongodb/mongo
3-
version: 3.5.6
3+
version: 3.5.7
44
appVersion: 3.6
55
description: NoSQL document-oriented database that stores JSON-like documents with
66
dynamic schemas, simplifying the integration of data in content-driven applications.

stable/mongodb-replicaset/init/on-start.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ for peer in "${peers[@]}"; do
116116
if mongo admin --host "$peer" "${admin_creds[@]}" "${ssl_args[@]}" --eval "rs.isMaster()" | grep '"ismaster" : true'; then
117117
log "Found master: $peer"
118118
log "Adding myself ($service_name) to replica set..."
119-
mongo admin --host "$peer" "${admin_creds[@]}" "${ssl_args[@]}" --eval "rs.add('$service_name')"
119+
if mongo admin --host "$peer" "${admin_creds[@]}" "${ssl_args[@]}" --eval "rs.add('$service_name')" | grep 'Quorum check failed'; then
120+
log 'Quorum check failed, unable to join replicaset. Exiting prematurely.'
121+
shutdown_mongo
122+
exit 1
123+
fi
120124

121125
sleep 3
122126

0 commit comments

Comments
 (0)