Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Kubeblocks pika-master-slave-group #2894

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 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 All @@ -46,3 +46,23 @@ helm upgrade pika-cluster ./pika-cluster

### Scale in
scale in is not supported now.

## Install pika Master/Slave group by kubeblocks

### Install pika CD and pika Master/Slave
First,use helm install pika-master-slave-group componentdefinition and pika-master-slave cluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the missing preposition.

The sentence in line 53 is missing the preposition "to" after "First,".

Apply this diff to fix the missing preposition:

-First,use helm install pika-master-slave-group componentdefinition and pika-master-slave cluster
+First, use helm to install pika-master-slave-group componentdefinition and pika-master-slave cluster
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
First,use helm install pika-master-slave-group componentdefinition and pika-master-slave cluster
First, use helm to install pika-master-slave-group componentdefinition and pika-master-slave cluster
Tools
LanguageTool

[uncategorized] ~53-~53: Possible missing preposition found.
Context: ...D and pika Master/Slave First,use helm install pika-master-slave-group componentdefini...

(AI_HYDRA_LEO_MISSING_TO)

```bash
cd ./tools/kubeblocks-helm/
helm install pika-master-slave-group ./pika-master-slave-group
helm install pika-master-slave ./pika-master-slave-group
```
Wait for pika-master-slave-pika-{index} pods until the status all to be `Running`.
```bash
kubectl get pods --watch
````
### connect to pika master-slave group
```bash
kubectl port-forward svc/pika-master-slave-pika 9221
#start new terminal
redis-cli -p 9221
```
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-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fullnameOverride: ""

groupCount: 2

slaveCount: 1
slaveCount: 2

etcdReplicaCount: 3

Expand Down
23 changes: 23 additions & 0 deletions tools/kubeblocks_helm/pika-master-slave-group/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
21 changes: 21 additions & 0 deletions tools/kubeblocks_helm/pika-master-slave-group/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: pika
description: A Pika Master Slave Group definition Helm chart for Kubernetes

type: application

version: 0.9.0

appVersion: "3.5.3"

home: https://github.com/OpenAtomFoundation/pika
keywords:
- pika
- redis
- database
- nosql
- replication

maintainers:
- name: pika
url: https://github.com/OpenAtomFoundation/pika/tools/kubeblocks_helm
Loading
Loading