Skip to content

Commit 4b1e483

Browse files
Ensure we do not deploy more than 3 replicas per sts
- We want to support one P-S-S topology ever 3 servers. - With 6+ nodes support added, we now need to ensure the replicas of configsvr & shardsvr are not exceeding 3. Issue: ZENKO-4641
1 parent 3f7b964 commit 4b1e483

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

solution-base/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ function render_mongodb_sharded_yamls()
8484
local OUTPUT_PATH=${1:-${OPERATOR_PATH}}
8585
local SHARD_COUNT=${2:-1}
8686
local NODE_COUNT=${3:-1}
87-
local REPLICA_COUNT=${3:-${NODE_COUNT}}
87+
local MAX_REPLICA_PER_SHARD=3
88+
local REPLICA_COUNT=$(( $3 > $MAX_REPLICA_PER_SHARD ? $MAX_REPLICA_PER_SHARD : $3 ))
8889

8990
echo creating mongodb-sharded ${NODE_COUNT}-node yamls
9091
CHART_PATH="$SOLUTION_BASE_DIR/mongodb/charts/mongodb-sharded"
@@ -100,7 +101,7 @@ function render_mongodb_sharded_yamls()
100101
--set shardsvr.dataNode.replicaCount=${REPLICA_COUNT} \
101102
--set shardsvr.persistence.enabled=true \
102103
--set shardsvr.persistence.storageClass=${MONGODB_STORAGE_CLASS} \
103-
--set configsvr.replicaCount=${REPLICA_COUNT} \
104+
--set configsvr.replicaCount=$(( $NODE_COUNT > 2 ? 3 : 1 )) \
104105
--set configsvr.persistence.enabled=true \
105106
--set configsvr.persistence.storageClass=${MONGODB_STORAGE_CLASS} \
106107
--set metrics.enabled=true \

0 commit comments

Comments
 (0)