Skip to content

Commit

Permalink
chore: refactor roles (#1428)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1145cd8)
  • Loading branch information
cjc7373 committed Jan 23, 2025
1 parent 5e35ed2 commit f5f7cd0
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 106 deletions.
15 changes: 6 additions & 9 deletions addons/apecloud-mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,14 @@ tls:
keyFile: key.pem
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 3
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 2
participatesInQuorum: true
- name: learner
serviceable: false
writable: false
votable: false
updatePriority: 1
participatesInQuorum: false
lifecycleActions:
roleProbe:
periodSeconds: {{ .Values.roleProbe.periodSeconds }}
Expand Down
15 changes: 6 additions & 9 deletions addons/apecloud-postgresql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,14 @@ volumes:
needSnapshot: false
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 3
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 2
participatesInQuorum: true
- name: learner
serviceable: false
writable: false
votable: false
updatePriority: 1
participatesInQuorum: false
vars:
## the postgres leader pod name which is dynamically selected, caution to use it
- name: POSTGRES_LEADER_POD_NAME
Expand Down
10 changes: 4 additions & 6 deletions addons/etcd/templates/cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ spec:
updateStrategy: Serial
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 2
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 1
participatesInQuorum: true
lifecycleActions:
roleProbe:
exec:
Expand Down
5 changes: 2 additions & 3 deletions addons/minio/templates/cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ spec:

roles:
- name: readwrite
serviceable: true
votable: false
writable: true
updatePriority: 1
participatesInQuorum: false

lifecycleActions:
roleProbe:
Expand Down
8 changes: 4 additions & 4 deletions addons/mogdb/templates/cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ spec:
{{- end }}
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
systemAccounts:
- name: root
initAccount: true
Expand Down
10 changes: 4 additions & 6 deletions addons/mongodb/templates/componentdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ spec:
letterCase: MixedCases
roles:
- name: primary
serviceable: true
writable: true
votable: true
updatePriority: 2
participatesInQuorum: true
- name: secondary
serviceable: true
writable: false
votable: true
updatePriority: 1
participatesInQuorum: true
lifecycleActions:
roleProbe:
periodSeconds: {{ .Values.roleProbe.periodSeconds }}
Expand Down
16 changes: 8 additions & 8 deletions addons/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ lifecycleActions:
/tools/syncerctl switchover --primary "$KB_LEADER_POD_NAME" ${KB_SWITCHOVER_CANDIDATE_NAME:+--candidate "$KB_SWITCHOVER_CANDIDATE_NAME"}
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: true
writable: false
updatePriority: 1
participatesInQuorum: false
{{- end }}

{{- define "mysql.spec.runtime.common" -}}
Expand Down Expand Up @@ -281,11 +281,11 @@ systemAccounts:
statement: CREATE USER IF NOT EXISTS '${KB_ACCOUNT_NAME}' IDENTIFIED BY '${KB_ACCOUNT_PASSWORD}'; GRANT SELECT ON performance_schema.* TO '${KB_ACCOUNT_NAME}'; GRANT SELECT ON sys.* TO '${KB_ACCOUNT_NAME}';
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: true
writable: false
updatePriority: 1
participatesInQuorum: false
vars:
- name: ORC_TOPOLOGY_USER
valueFrom:
Expand Down
10 changes: 4 additions & 6 deletions addons/orchestrator/templates/cmpd-raft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ spec:
{{- include "orchestrator.cmpd.spec.common" . | nindent 2 }}
roles:
- name: primary
serviceable: true
writable: true
votable: true
updatePriority: 2
participatesInQuorum: true
- name: secondary
serviceable: true
writable: false
votable: true
updatePriority: 1
participatesInQuorum: true
vars:
- name: ORC_META_DATABASE
value: orchestrator
Expand Down
10 changes: 4 additions & 6 deletions addons/polardbx/templates/cmpd-dn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ spec:
updateStrategy: Serial
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 2
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 1
participatesInQuorum: true
volumes:
- name: data
vars:
Expand Down
10 changes: 4 additions & 6 deletions addons/polardbx/templates/cmpd-gms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ spec:
updateStrategy: Serial
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 2
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 1
participatesInQuorum: true
volumes:
- name: data
vars:
Expand Down
8 changes: 4 additions & 4 deletions addons/postgresql/templates/componentdefinition-12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
8 changes: 4 additions & 4 deletions addons/postgresql/templates/componentdefinition-14.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
8 changes: 4 additions & 4 deletions addons/postgresql/templates/componentdefinition-15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
8 changes: 4 additions & 4 deletions addons/postgresql/templates/componentdefinition-16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
8 changes: 4 additions & 4 deletions addons/redis/templates/cmpd-redis-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
8 changes: 4 additions & 4 deletions addons/redis/templates/cmpd-redis-cluster-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ spec:
needSnapshot: true
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: false
writable: false
updatePriority: 1
participatesInQuorum: false
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
10 changes: 4 additions & 6 deletions addons/tidb/templates/componentdefinition-pd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ spec:
volumeName: config
roles:
- name: leader
serviceable: true
votable: true
writable: true
updatePriority: 2
participatesInQuorum: true
- name: follower
serviceable: true
votable: true
writable: false
updatePriority: 1
participatesInQuorum: true
lifecycleActions:
roleProbe:
exec:
Expand Down
8 changes: 4 additions & 4 deletions addons/vanilla-postgresql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ services:
roleSelector: primary
roles:
- name: primary
serviceable: true
writable: true
updatePriority: 2
participatesInQuorum: false
- name: secondary
serviceable: true
writable: false
updatePriority: 1
participatesInQuorum: false
volumes:
- name: data
needSnapshot: true
Expand Down
15 changes: 6 additions & 9 deletions addons/zookeeper/templates/cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ spec:
port: 8080
roles:
- name: leader
serviceable: true
writable: true
votable: true
updatePriority: 3
participatesInQuorum: true
- name: follower
serviceable: true
writable: false
votable: true
updatePriority: 2
participatesInQuorum: true
- name: observer
serviceable: false
writable: false
votable: false
updatePriority: 1
participatesInQuorum: false
updateStrategy: BestEffortParallel
vars:
- name: ZOOKEEPER_POD_FQDN_LIST
Expand Down

0 comments on commit f5f7cd0

Please sign in to comment.