Skip to content

Commit 53e6726

Browse files
committed
feat(mongodb): use syncer shard lifecycle APIs
1 parent cd5c4ee commit 53e6726

4 files changed

Lines changed: 12 additions & 222 deletions

File tree

addons/mongodb/scripts/mongodb-shard-manage.sh

Lines changed: 0 additions & 212 deletions
This file was deleted.

addons/mongodb/templates/cmpd-mongodb-shard.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@ spec:
100100
exec:
101101
container: mongodb
102102
command:
103-
- /bin/bash
104-
- -c
105-
- /scripts/mongodb-shard-manage.sh --post-provision >> /tmp/post-provision.log 2>&1
103+
- /tools/syncerctl
104+
- add-shard
106105
targetPodSelector: Role
107106
matchingKey: primary
108107
preCondition: RuntimeReady
109108
retryPolicy:
110-
maxRetries: 10
109+
# syncerctl returns non-zero while the asynchronous add-shard task is
110+
# still Running. Let KubeBlocks poll until Syncer reports Succeeded.
111+
maxRetries: 300
112+
retryInterval: 2000000000 # 2s, encoded as time.Duration nanoseconds
111113
runtime:
112114
securityContext:
113115
# percona-server-mongodb needs run as root to have privilege to access to keyfile

addons/mongodb/templates/scriptstemplate-shard.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ data:
1010
1111
DATA_VOLUME={{ .Values.dataMountPath }}
1212
{{- .Files.Get "scripts/mongodb-shard-setup.sh" | nindent 4 }}
13-
mongodb-shard-manage.sh: |-
14-
{{- .Files.Get "scripts/mongodb-shard-manage.sh" | nindent 4 }}
1513
backup-agent-setup.sh: |-
1614
{{- .Files.Get "scripts/backup-agent-setup.sh" | nindent 4 }}
1715
mongodb-mongos-setup.sh: |-

addons/mongodb/templates/shardingdefinition.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ spec:
1919
exec:
2020
container: mongodb
2121
command:
22-
- /bin/bash
23-
- -c
24-
- /scripts/mongodb-shard-manage.sh --pre-terminate >> /tmp/pre-terminate.log 2>&1
22+
- /tools/syncerctl
23+
- remove-shard
2524
targetPodSelector: Role
2625
matchingKey: primary
2726
retryPolicy:
28-
maxRetries: 10
27+
# Syncer drains chunks and database primaries asynchronously. Each
28+
# lifecycle retry polls the same in-process task until it succeeds.
29+
maxRetries: 1800
30+
retryInterval: 2000000000 # 2s, encoded as time.Duration nanoseconds
2931

0 commit comments

Comments
 (0)