Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ fi

if [ -f "/keydir-readonly/key.txt" ]; then
cp /keydir-readonly/key.txt /data/configdb/key.txt
chmod 400 /data/configdb/key.txt
chmod 400 /data/configdb/key.txt
fi
8 changes: 4 additions & 4 deletions mongos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ fi

mongosh "$ipv6" --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "sh.enableSharding('kubedb-system');"
if [ -n "$ipv6" ]; then
mongosh kubedb-system "$ipv6" --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db['health-check'].createIndex({'id': 1});"
mongosh kubedb-system "$ipv6" --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db['health-check'].createIndex({'id': 1});"
else
mongosh kubedb-system --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db['health-check'].createIndex({'id': 1});"
mongosh kubedb-system --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db['health-check'].createIndex({'id': 1});"
fi
mongosh "$ipv6" --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "sh.shardCollection('kubedb-system.health-check', {'id': 1});"

Expand Down Expand Up @@ -139,12 +139,12 @@ process_init_files() {
log "Ensure Initializing init scripts"
if [ -n "$ipv6" ]; then
if [[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.find({'_id': 'kubedb', 'kubedb': 'initialized'}).count()" --ipv6 | tail -1) == 0 ]] &&
[[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.insertOne({'_id': 'kubedb', 'kubedb': 'initialized'})" --ipv6 2>&1 | grep -c "E11000 duplicate key error collection: admin.kubedb") -eq 0 ]]; then
[[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.insertOne({'_id': 'kubedb', 'kubedb': 'initialized'})" --ipv6 2>&1 | grep -c "E11000 duplicate key error collection: admin.kubedb") -eq 0 ]]; then
process_init_files
fi
else
if [[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.find({'_id': 'kubedb', 'kubedb': 'initialized'}).count()" | tail -1) == 0 ]] &&
[[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.insertOne({'_id': 'kubedb', 'kubedb': 'initialized'})" 2>&1 | grep -c "E11000 duplicate key error collection: admin.kubedb") -eq 0 ]]; then
[[ $(mongosh admin --host localhost "${admin_creds[@]}" "${ssl_args[@]}" --json --eval "db.kubedb.insertOne({'_id': 'kubedb', 'kubedb': 'initialized'})" 2>&1 | grep -c "E11000 duplicate key error collection: admin.kubedb") -eq 0 ]]; then
process_init_files
fi
fi
Expand Down