Skip to content

Commit

Permalink
chore: support tidb 6.5 (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjc7373 authored Sep 10, 2024
1 parent a0eb010 commit e34a4e4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
3 changes: 3 additions & 0 deletions addons-cluster/tidb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ tidb:
# The RBAC permission used by cluster component pod, now include event.create
serviceAccount:
name: ""

extra:
rbacEnabled: true
6 changes: 6 additions & 0 deletions addons/tidb/scripts/pd_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ if [[ -f $DATA_DIR/join ]]; then
elif [[ ! -d $DATA_DIR/member/wal ]]; then
echo "first started pod"
replicas=$(echo "${KB_POD_LIST}" | tr ',' '\n')
# FIXME: Relying on leader status to determine whether to join or initialize a cluster
# is unreliable. Consider a scenario with 3 pods: 2 start normally, while the 3rd pod
# pulls image slowly and is still initializing. During this time, the PD cluster
# achieves quorum and begins to work, thus KB's role probe succeeds.
# When the third pod eventually starts, it mistakenly attempts to join the
# cluster based on the KB_LEADER env, leading to a failure.
if [[ -n $KB_LEADER || -n $KB_FOLLOWERS ]]; then
echo "joining an existing cluster"
join=""
Expand Down
17 changes: 15 additions & 2 deletions addons/tidb/templates/componentdefinition-tidb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ spec:
description: tidb's SQL layer
serviceKind: MySQL
updateStrategy: BestEffortParallel
vars:
- name: PD_HOST
valueFrom:
serviceVarRef:
compDef: tidb-pd-7
host: Required
- name: PD_PORT
valueFrom:
serviceVarRef:
compDef: tidb-pd-7
port:
name: client
- name: PD_ADDRESS
value: "$(PD_HOST).$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:$(PD_PORT)"
runtime:
containers:
- name: tidb
Expand All @@ -23,11 +37,10 @@ spec:
- -c
- |
echo "start tidb..."
DOMAIN=$KB_NAMESPACE".svc{{ .Values.clusterDomain }}"
exec /tidb-server --store=tikv \
--advertise-address=${KB_POD_FQDN}{{ .Values.clusterDomain }} \
--host=0.0.0.0 \
--path=${KB_CLUSTER_NAME}-tidb-pd.${DOMAIN}:2379 \
--path=${PD_ADDRESS} \
--log-slow-query=/var/log/tidb/slowlog \
--config=/etc/tidb/tidb.toml
volumeMounts:
Expand Down
20 changes: 18 additions & 2 deletions addons/tidb/templates/componentversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ spec:
serviceVersion: "7.1.5"
images:
pd: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v7.1.5
- name: "6.5.10"
serviceVersion: "6.5.10"
images:
pd: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v6.5.10
compatibilityRules:
- compDefs:
- "tidb-pd-7"
releases:
- "7.1.5"
- "7.5.2"
- "6.5.10"

---
apiVersion: apps.kubeblocks.io/v1alpha1
Expand All @@ -34,18 +39,24 @@ spec:
serviceVersion: "7.5.2"
images:
tidb: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tidb.repository }}:v7.5.2
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}/{{ .Values.image.helper.tag }}
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}:{{ .Values.image.helper.tag }}
- name: "7.1.5"
serviceVersion: "7.1.5"
images:
tidb: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tidb.repository }}:v7.1.5
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}/{{ .Values.image.helper.tag }}
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}:{{ .Values.image.helper.tag }}
- name: "6.5.10"
serviceVersion: "6.5.10"
images:
tidb: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tidb.repository }}:v6.5.10
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}:{{ .Values.image.helper.tag }}
compatibilityRules:
- compDefs:
- "tidb-7"
releases:
- "7.1.5"
- "7.5.2"
- "6.5.10"

---
apiVersion: apps.kubeblocks.io/v1alpha1
Expand All @@ -64,9 +75,14 @@ spec:
serviceVersion: "7.1.5"
images:
tikv: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tikv.repository }}:v7.1.5
- name: "6.5.10"
serviceVersion: "6.5.10"
images:
tikv: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tikv.repository }}:v6.5.10
compatibilityRules:
- compDefs:
- "tikv-7"
releases:
- "7.1.5"
- "7.5.2"
- "6.5.10"

0 comments on commit e34a4e4

Please sign in to comment.