Skip to content

Commit

Permalink
feat:Update kubeblocks version to 0.9 (#2860)
Browse files Browse the repository at this point in the history
* kb0.9
  • Loading branch information
XiaoLiang2333 authored Sep 24, 2024
1 parent 8f0cd18 commit 15f457f
Show file tree
Hide file tree
Showing 23 changed files with 167 additions and 546 deletions.
2 changes: 1 addition & 1 deletion tools/kubeblocks_helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kubectl get cluster --watch
### Add Pika instance to codis
Then connect codis front end.
```bash
kubectl port-forward svc/pika-cluster-codis-fe 8080
kubectl port-forward svc/pika-cluster-codis-fe 8080
```
Open browser and visit `http://localhost:8080`

Expand Down
2 changes: 1 addition & 1 deletion tools/kubeblocks_helm/pika-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Pika Codis Cluster Helm chart for KubeBlocks.

type: application

version: 0.7.1-beta.1
version: 0.9.0

appVersion: "3.5.3"

Expand Down
55 changes: 15 additions & 40 deletions tools/kubeblocks_helm/pika-cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ metadata:
namespace: {{ .Release.Namespace }}
labels: {{ include "pika-cluster.labels" . | nindent 4 }}
spec:
clusterDefinitionRef: pika # ref clusterDefinition.name
clusterVersionRef: pika-{{ default .Chart.AppVersion .Values.clusterVersionOverride }} # ref clusterVersion.name
terminationPolicy: {{ .Values.terminationPolicy }}
affinity:
{{- with .Values.topologyKeys }}
Expand All @@ -15,14 +13,15 @@ spec:
{{- with $.Values.tolerations }}
tolerations: {{ . | toYaml | nindent 4 }}
{{- end }}
## define pika group with shardingSpecs API which is supported in KubeBlocks v0.8.2
{{- if not .Values.useLegacyCompDef }}
shardingSpecs:
- name: group
shards: {{ .Values.groupCount }}
template:
name: pika
componentDef: pika-group
enabledLogs: {{ $.Values.enabledLogs | toJson | indent 4 }}
serviceAccountName: {{ include "pika-cluster.serviceAccountName" $ }}
replicas: {{ add (int $.Values.slaveCount) 1 | default 2 }}
{{- with $.Values.resources.pikaGroup }}
resources:
Expand Down Expand Up @@ -51,13 +50,10 @@ spec:
{{- if .Values.useLegacyCompDef }}
{{- range $i := until (int .Values.groupCount) }}
- name: pika-group-{{ add ($i) 1 }} # user-defined
componentDefRef: pika-group # ref clusterDefinition.componentDefs[x].name
monitor: {{ $.Values.monitor.enabled | default false }}
componentDef: pika-group # Ref componentdefinition.name
enabledLogs: {{ $.Values.enabledLogs | toJson | indent 4 }}
replicas: {{ add (int $.Values.slaveCount) 1 | default 2 }}
serviceAccountName: {{ include "pika-cluster.serviceAccountName" $ }}
switchPolicy:
type: {{ $.Values.switchPolicy.type}}
{{- with $.Values.resources.pikaGroup }}
resources:
limits:
Expand All @@ -70,7 +66,7 @@ spec:
{{- if $.Values.persistence.enabled }}
volumeClaimTemplates:
{{- with $.Values.persistence.pikaData }}
- name: data # ref clusterdefinition components.containers.volumeMounts.name
- name: data # ref componentDefinition.containers.volumeMounts.name
spec:
storageClassName: {{ .storageClassName }}
accessModes:
Expand All @@ -83,12 +79,7 @@ spec:
{{- end }}
{{- end }}
- name: etcd # user-defined
{{- if .Values.useLegacyCompDef }}
componentDefRef: etcd # ref clusterDefinition.componentDefs[x].name
{{- else }}
componentDef: pika-etcd # ref componentDefinition name
{{- end }}
monitor: {{ .Values.monitor.enabled | default false }}
replicas: {{ .Values.etcdReplicaCount| default 3 }}
{{- with .Values.resources.etcd }}
resources:
Expand All @@ -106,7 +97,7 @@ spec:
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
{{- with $.Values.persistence.etcdData }}
- name: data # ref clusterdefinition components.containers.volumeMounts.name
- name: data # ref componentDefinition.containers.volumeMounts.name
spec:
storageClassName: {{ .storageClassName }}
accessModes:
Expand All @@ -116,15 +107,10 @@ spec:
storage: {{ .size }}
{{- end }}
{{- end }}
- name: pika-exporter
{{- if .Values.useLegacyCompDef }}
componentDefRef: pika-exporter # ref clusterDefinition.componentDefs[x].name
{{- else }}
componentDef: pika-exporter # ref componentDefinition name
{{- end }}
monitor: {{ .Values.monitor.enabled | default false }}
replicas: 1
{{- with .Values.resources.pikaExporter }}
- name: codis-proxy
componentDef: pika-codis-proxy # ref componentDefinition name
replicas: {{ .Values.codisProxyReplicaCount | default 2 }}
{{- with .Values.resources.codisProxy }}
resources:
limits:
cpu: {{ .limits.cpu | quote }}
Expand All @@ -133,14 +119,11 @@ spec:
cpu: {{ .requests.cpu | quote }}
memory: {{ .requests.memory | quote }}
{{- end }}
- name: codis-proxy
{{- if .Values.useLegacyCompDef }}
componentDefRef: codis-proxy # ref clusterDefinition.componentDefs[x].name
{{- else }}
componentDef: pika-codis-proxy # ref componentDefinition name
{{- end }}
replicas: {{ .Values.codisProxyReplicaCount | default 2 }}
{{- with .Values.resources.codisProxy }}
- name: pika-exporter
componentDef: pika-exporter # ref componentDefinition name
monitor: {{ .Values.monitor.enabled | default false }}
replicas: 1
{{- with .Values.resources.pikaExporter }}
resources:
limits:
cpu: {{ .limits.cpu | quote }}
Expand All @@ -150,11 +133,7 @@ spec:
memory: {{ .requests.memory | quote }}
{{- end }}
- name: codis-fe
{{- if .Values.useLegacyCompDef }}
componentDefRef: codis-fe # ref clusterDefinition.componentDefs[x].name
{{- else }}
componentDef: pika-codis-fe # ref componentDefinition name
{{- end }}
replicas: {{ .Values.codisFeReplicaCount | default 1 }}
{{- with .Values.resources.codisFe }}
resources:
Expand All @@ -166,11 +145,7 @@ spec:
memory: {{ .requests.memory | quote }}
{{- end }}
- name: codis-dashboard
{{- if .Values.useLegacyCompDef }}
componentDefRef: codis-dashboard # ref clusterDefinition.componentDefs[x].name
{{- else }}
componentDef: pika-codis-dashboard # ref componentDefinition name
{{- end }}
replicas: 1
{{- with .Values.resources.codisFe }}
resources:
Expand All @@ -180,4 +155,4 @@ spec:
requests:
cpu: {{ .requests.cpu | quote }}
memory: {{ .requests.memory | quote }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion tools/kubeblocks_helm/pika/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.hg/
.hgignore
.svn/
# Common backup files
# Common files
*.swp
*.bak
*.tmp
Expand Down
2 changes: 1 addition & 1 deletion tools/kubeblocks_helm/pika/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Pika Codis cluster definition Helm chart for Kubernetes

type: application

version: 0.7.1-beta.1
version: 0.9.0

appVersion: "3.5.3"

Expand Down
6 changes: 3 additions & 3 deletions tools/kubeblocks_helm/pika/script/admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set_instance_role() {

# set group id
set_group_id() {
GROUP_ID=${KB_CLUSTER_COMP_NAME##*-}
GROUP_ID=${KB_COMP_NAME##*-}
echo "GROUP_ID: "${GROUP_ID}
}

Expand Down Expand Up @@ -81,8 +81,8 @@ reload_until_success() {

register_server() {
reload_until_success
if [ ${POD_ID} -gt 0 ]; then wait_all_master_registered; fi
$CODIS_ADMIN --create-group --gid=${GROUP_ID} 1>/dev/null 2>&1
if [ ${POD_ID} -eq 0 ]; then $CODIS_ADMIN --create-group --gid=${GROUP_ID} 1>/dev/null 2>&1; fi
if [ ${POD_ID} -gt 0 ]; then wait_all_master_registered; sleep 5; fi
$CODIS_ADMIN --group-add --gid=${GROUP_ID} --addr=${KB_POD_FQDN}:9221
$CODIS_ADMIN --sync-action --create --addr=${KB_POD_FQDN}:9221 1>/dev/null 2>&1
}
Expand Down
Loading

0 comments on commit 15f457f

Please sign in to comment.