Skip to content

Commit

Permalink
chore: support tidb 8.4 (#1384)
Browse files Browse the repository at this point in the history
Co-authored-by: cjc7373 <[email protected]>
(cherry picked from commit 6034185)
  • Loading branch information
cjc7373 committed Jan 23, 2025
1 parent d8f0402 commit 2e559da
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ KubeBlocks add-ons.
| risingwave | risingwave-compactor-v1.0.0<br>risingwave-compute-v1.0.0<br>risingwave-connector-v1.0.0<br>risingwave-frontend-v1.0.0<br>risingwave-meta-v1.0.0 | RisingWave is a distributed SQL streaming database that enables cost-efficient and reliable processing of streaming data. | RisingWave Labs |
| starrocks-ce | starrocks-ce-be-1.0.0-alpha.0-3.2.2<br>starrocks-ce-be-1.0.0-alpha.0-3.3.0<br>starrocks-ce-fe-1.0.0-alpha.0-3.2.2<br>starrocks-ce-fe-1.0.0-alpha.0-3.3.0 | A Linux Foundation project, is the next-generation data platform designed to make data-intensive real-time analytics fast and easy. | yandongxiao iziang |
| tdengine | tdengine-3.0.5 | TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, Industrial IoT and DevOps. | leon-inf |
| tidb | tidb-6.5.10<br>tidb-7.1.5<br>tidb-7.5.2<br>tidb-pd-6.5.10<br>tidb-pd-7.1.5<br>tidb-pd-7.5.2<br>tikv-6.5.10<br>tikv-7.1.5<br>tikv-7.5.2 | TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. | csuzhangxc cjc7373 |
| tidb | tidb-6.5.10<br>tidb-7.1.5<br>tidb-7.5.2<br>tidb-8.4.0<br>tidb-pd-6.5.10<br>tidb-pd-7.1.5<br>tidb-pd-7.5.2<br>tidb-pd-8.4.0<br>tikv-6.5.10<br>tikv-7.1.5<br>tikv-7.5.2<br>tikv-8.4.0 | TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. | csuzhangxc cjc7373 |
| vanilla-postgresql | anilla-postgresql-12.15.0<br>anilla-postgresql-14.7.0<br>anilla-postgresql-15.6.1-138<br>anilla-postgresql-15.7.0 | Vanilla-PostgreSQL is compatible with the native PostgreSQL kernel, enabling it to quickly provide HA solutions for various variants based on the native PostgreSQL kernel. | kizuna-lek |
| victoria-metrics | ictoria-metrics-1.0.0 | VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. | sophon-zt ButterBright |
| weaviate | weaviate-1.19.6 | Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly into billions of data objects. | iziang |
Expand Down
4 changes: 2 additions & 2 deletions addons-cluster/tidb/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: {{ include "clustername" . }}
name: {{ include "kblib.clusterName" . }}
namespace: {{ .Release.Namespace }}
labels: {{ include "tidb-cluster.labels" . | nindent 4 }}
spec:
clusterDef: tidb # ref clusterdefinition.name
terminationPolicy: {{ $.Values.terminationPolicy }}
terminationPolicy: {{ $.Values.extra.terminationPolicy }}
topology: cluster
componentSpecs:
{{- with $.Values.pd }}
Expand Down
6 changes: 2 additions & 4 deletions addons-cluster/tidb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

## @param terminationPolicy define Cluster termination policy. One of DoNotTerminate, Delete, WipeOut.
##
terminationPolicy: Delete

# @param appVersionOverride
# if not empty, it will override the default tidb version
# the version must be defined in the ComponentVersion cr.
Expand Down Expand Up @@ -58,3 +54,5 @@ serviceAccount:

extra:
rbacEnabled: true
# @param terminationPolicy define Cluster termination policy. One of DoNotTerminate, Halt, Delete, WipeOut.
terminationPolicy: Delete
4 changes: 2 additions & 2 deletions addons/tidb/dataprotection/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ trap handle_exit EXIT

function getToolConfigValue() {
local var=$1
cat $toolConfig | grep "$var" | awk '{print $NF}'
cat $toolConfig | grep "^$var" | awk '{print $NF}'
}

access_key_id=$(getToolConfigValue access_key_id)
secret_access_key=$(getToolConfigValue secret_access_key)
endpoint=$(getToolConfigValue endpoint)
bucket=$(getToolConfigValue root)
bucket=$(getToolConfigValue "root")

# FIXME: hardcoded port
/br backup full --pd "$DP_DB_HOST:2379" --storage "s3://$bucket$DP_BACKUP_BASE_PATH?access-key=$access_key_id&secret-access-key=$secret_access_key" --s3.endpoint "$endpoint"
Expand Down
4 changes: 2 additions & 2 deletions addons/tidb/dataprotection/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ toolConfig=/etc/datasafed/datasafed.conf

function getToolConfigValue() {
local var=$1
cat $toolConfig | grep "$var" | awk '{print $NF}'
cat $toolConfig | grep "^$var" | awk '{print $NF}'
}

access_key_id=$(getToolConfigValue access_key_id)
secret_access_key=$(getToolConfigValue secret_access_key)
endpoint=$(getToolConfigValue endpoint)
bucket=$(getToolConfigValue root)
bucket=$(getToolConfigValue "root")

# FIXME: hardcoded port
/br restore full --pd "$DP_DB_HOST:2379" --storage "s3://$bucket$DP_BACKUP_BASE_PATH?access-key=$access_key_id&secret-access-key=$secret_access_key" --s3.endpoint "$endpoint"
8 changes: 8 additions & 0 deletions addons/tidb/scripts/pd_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ set_join_args() {
}

get_current_pod_fqdn() {
if [[ -z $CURRENT_POD_NAME ]]; then
echo "CURRENT_POD_NAME not set"
exit 1
fi
if [[ -z $PD_POD_FQDN_LIST ]]; then
echo "PD_POD_FQDN_LIST not set"
exit 1
fi
replicas=$(echo "${PD_POD_FQDN_LIST}" | tr ',' '\n')
echo "$replicas" | grep "$CURRENT_POD_NAME"
}
Expand Down
4 changes: 2 additions & 2 deletions addons/tidb/templates/actionset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
backupType: Full
backup:
backupData:
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.br.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.br.repository }}:$(IMAGE_TAG)
syncProgress:
enabled: false
intervalSeconds: 5
Expand All @@ -20,7 +20,7 @@ spec:
restore:
postReady:
- job:
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.br.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.br.repository }}:$(IMAGE_TAG)
command:
- bash
- -c
Expand Down
11 changes: 11 additions & 0 deletions addons/tidb/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ spec:
- name: br
snapshotVolumes: false
actionSetName: tidb-br
env:
- name: IMAGE_TAG
valueFrom:
versionMapping:
- serviceVersions:
- "6"
- "7"
mappedValue: "v7.5.2"
- serviceVersions:
- "8"
mappedValue: "v8.4.0"
6 changes: 4 additions & 2 deletions addons/tidb/templates/componentdefinition-pd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: SERVICE_PORT
value: "2379"
ports:
- containerPort: 2379
name: client
Expand Down Expand Up @@ -78,9 +80,9 @@ spec:
- |
LEADER_NAME=$(/pd-ctl member | jq -r '.leader.name')
if [ "$LEADER_NAME" == "$HOSTNAME" ]; then
echo "leader"
echo -n "leader"
else
echo "follower"
echo -n "follower"
fi
memberLeave:
exec:
Expand Down
3 changes: 3 additions & 0 deletions addons/tidb/templates/componentdefinition-tidb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: SERVICE_PORT
value: "10080"
ports:
- containerPort: 4000
name: client
Expand All @@ -61,6 +63,7 @@ spec:
--host=0.0.0.0 \
--path=${PD_ADDRESS} \
--log-slow-query=/var/log/tidb/slowlog \
--log-file=/var/log/tidb/running.log \
--config=/etc/tidb/tidb.toml
volumeMounts:
- name: slowlog
Expand Down
2 changes: 2 additions & 0 deletions addons/tidb/templates/componentdefinition-tikv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: SERVICE_PORT
value: "20180"
ports:
- containerPort: 20160
name: peer
Expand Down
25 changes: 22 additions & 3 deletions addons/tidb/templates/componentversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ metadata:
{{- include "tidb.apiVersion" . | nindent 4 }}
spec:
releases:
- name: "8.4.0"
serviceVersion: "8.4.0"
images:
pd: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v8.4.0
roleProbe: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v8.4.0
memberLeave: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v8.4.0
- name: "7.5.2"
serviceVersion: "7.5.2"
images:
Expand All @@ -30,8 +36,9 @@ spec:
- compDefs:
- {{ include "tidb.pd7.cmpdRegexpPattern" . }}
releases:
- "7.1.5"
- "8.4.0"
- "7.5.2"
- "7.1.5"
- "6.5.10"

---
Expand All @@ -45,6 +52,11 @@ metadata:
{{- include "tidb.apiVersion" . | nindent 4 }}
spec:
releases:
- name: "8.4.0"
serviceVersion: "8.4.0"
images:
tidb: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tidb.repository }}:v8.4.0
slowlog: {{ .Values.image.helper.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.image.helper.repository }}:{{ .Values.image.helper.tag }}
- name: "7.5.2"
serviceVersion: "7.5.2"
images:
Expand All @@ -64,8 +76,9 @@ spec:
- compDefs:
- {{ include "tidb.tidb7.cmpdRegexpPattern" . }}
releases:
- "7.1.5"
- "8.4.0"
- "7.5.2"
- "7.1.5"
- "6.5.10"

---
Expand All @@ -79,6 +92,11 @@ metadata:
{{- include "tidb.apiVersion" . | nindent 4 }}
spec:
releases:
- name: "8.4.0"
serviceVersion: "8.4.0"
images:
tikv: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tikv.repository }}:v8.4.0
memberLeave: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.pd.repository }}:v8.4.0
- name: "7.5.2"
serviceVersion: "7.5.2"
images:
Expand All @@ -98,6 +116,7 @@ spec:
- compDefs:
- {{ include "tidb.tikv7.cmpdRegexpPattern" . }}
releases:
- "7.1.5"
- "8.4.0"
- "7.5.2"
- "7.1.5"
- "6.5.10"

0 comments on commit 2e559da

Please sign in to comment.