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

Add helm install based on kubeblocks #1788

Merged
merged 16 commits into from
Aug 8, 2023
Merged
Prev Previous commit
Next Next commit
helm: fix image path error
  • Loading branch information
machinly committed Jul 22, 2023
commit 141b5a8093f4a07a3171192a5d421b32706bebb0
4 changes: 2 additions & 2 deletions tools/helm/pika-cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: {{ include "clustername" . }}
labels: {{ include "redis-cluster.labels" . | nindent 4 }}
spec:
clusterDefinitionRef: redis # ref clusterDefinition.name
clusterVersionRef: redis-{{ default .Chart.AppVersion .Values.clusterVersionOverride }} # ref clusterVersion.name
clusterDefinitionRef: pika # ref clusterDefinition.name
clusterVersionRef: pika-{{ default .Chart.AppVersion .Values.clusterVersionOverride }} # ref clusterVersion.name
terminationPolicy: {{ .Values.terminationPolicy }}
affinity:
{{- with .Values.topologyKeys }}
Expand Down
8 changes: 4 additions & 4 deletions tools/helm/pika/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ app.kubernetes.io/instance: {{ .Release.Name }}
Define image
*/}}
{{- define "pika.image" -}}
{{ .Values.pika.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
{{ .Values.pika.pika.image.registry | default "docker.io" }}/{{ .Values.pika.pika.image.repository }}:{{ .Values.pika.pika.image.tag }}
{{- end }}

{{- define "pika.imagePullPolicy" -}}
{{ .Values.pika.image.pullPolicy | default "IfNotPresent" }}
{{ .Values.pika.pika.image.pullPolicy | default "IfNotPresent" }}
{{- end }}

{{- define "codis.image" -}}
{{ .Values.codis.image.registry | default "docker.io" }}/{{ .Values.codis.image.repository }}:{{ .Values.codis.image.tag }}
{{ .Values.pika.codis.image.registry | default "docker.io" }}/{{ .Values.pika.codis.image.repository }}:{{ .Values.pika.codis.image.tag }}
{{- end }}
{{- define "codis.imagePullPolicy" -}}
{{ .Values.codis.image.pullPolicy | default "IfNotPresent" }}
{{ .Values.pika.codis.image.pullPolicy | default "IfNotPresent" }}
{{- end }}
75 changes: 3 additions & 72 deletions tools/helm/pika/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ spec:
namespace: {{ .Release.Namespace }}
volumeName: scripts
defaultMode: 493
monitor:
builtIn: false
exporterConfig:
scrapePort: 9121
scrapePath: "/metrics"
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand All @@ -62,50 +57,7 @@ spec:
mountPath: /data
- name: pika-conf
mountPath: /etc/pika
env:
- name: REDIS_REPL_USER
value: "kbreplicator"
- name: REDIS_REPL_PASSWORD
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: password
optional: false
- name: REDIS_DEFAULT_PASSWORD
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: password
optional: false
- name: REDIS_SENTINEL_USER
value: "$(REDIS_REPL_USER)-sentinel"
- name: REDIS_SENTINEL_PASSWORD
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: password
optional: false
- name: REDIS_ARGS
value: "--requirepass $(REDIS_PASSWORD)"
command: ["/scripts/pika-start.sh"]
lifecycle:
postStart:
exec:
command: ["/scripts/pika-post-start.sh"]
- name: pika-exporter
image: {{ .Values.exporter.image.registry }}/{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}
imagePullPolicy: IfNotPresent
ports:
- name: metrics
containerPort: 9121
livenessProbe:
httpGet:
path: /
port: metrics
readinessProbe:
httpGet:
path: /
port: metrics
command: ["/pika/bin/pika", "-c", "/etc/pika.conf"]
volumes:
- name: pod-info
downwardAPI:
Expand All @@ -120,9 +72,6 @@ spec:
fieldRef:
fieldPath: metadata.annotations['apps.kubeblocks.io/component-replicas']
systemAccounts:
# Seems pika-cli has its own mechanism to parse input tokens and there is no elegent way
# to pass $(KB_ACCOUNT_STATEMENT) to pika-cli without causing parsing error.
# Instead, using a shell script to wrap pika-cli and pass $(KB_ACCOUNT_STATEMENT) to it will do.
cmdExecutorConfig:
image: {{ include "pika.image" . }}
env:
Expand All @@ -136,33 +85,15 @@ spec:
- sh
- -c
args:
- "pika-cli -h $(KB_ACCOUNT_ENDPOINT) -a $REDIS_DEFAULT_PASSWORD $(KB_ACCOUNT_STATEMENT) | pika-cli -h $(KB_ACCOUNT_ENDPOINT) -a $REDIS_DEFAULT_PASSWORD acl save "
- "redis-cli -h $(KB_ACCOUNT_ENDPOINT) -a $REDIS_DEFAULT_PASSWORD $(KB_ACCOUNT_STATEMENT) | redis-cli -h $(KB_ACCOUNT_ENDPOINT) -a $REDIS_DEFAULT_PASSWORD acl save "
passwordConfig:
length: 10
numDigits: 5
numSymbols: 0
letterCase: MixedCases
accounts:
- name: kbadmin
provisionPolicy: &kbadminAcctRef
type: CreateByStmt
scope: AllPods
statements:
creation: ACL SETUSER $(USERNAME) ON \>$(PASSWD) allcommands allkeys
update: ACL SETUSER $(USERNAME) ON \>$(PASSWD)
- name: kbdataprotection
provisionPolicy: *kbadminAcctRef
- name: kbmonitoring
provisionPolicy: &kbReadOnlyAcctRef
type: CreateByStmt
scope: AllPods
statements:
creation: ACL SETUSER $(USERNAME) ON \>$(PASSWD) allkeys +get
update: ACL SETUSER $(USERNAME) ON \>$(PASSWD)
- name: kbprobe
provisionPolicy: *kbReadOnlyAcctRef
- name: codis-proxy
workloadType: Replication
workloadType: StatefulSet
characterType: pika
service:
ports:
Expand Down
10 changes: 5 additions & 5 deletions tools/helm/pika/templates/clusterversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ spec:
containers:
- name: pika
image: {{ include "pika.image" . }}
imagePullPolicy: {{ default .Values.pika.image.pullPolicy "IfNotPresent" }}
imagePullPolicy: {{ default .Values.pika.imagePullPolicy "IfNotPresent" }}
- componentDefRef: codis-dashboard
versionsContext:
containers:
- name: codis-dashboard
image: {{ include "codis.image" . }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
imagePullPolicy: {{ default .Values.imagePullPolicy "IfNotPresent" }}
- componentDefRef: codis-proxy
versionsContext:
containers:
- name: codis-proxy
image: {{ include "codis.image" . }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
imagePullPolicy: {{ default .Values.imagePullPolicy "IfNotPresent" }}
- componentDefRef: codis-sentinel
versionsContext:
containers:
- name: codis-sentinel
image: {{ include "codis.image" . }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
imagePullPolicy: {{ default .Values.imagePullPolicy "IfNotPresent" }}
- componentDefRef: codis-fe
versionsContext:
containers:
- name: codis-fe
image: {{ include "codis.image" . }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
imagePullPolicy: {{ default .Values.imagePullPolicy "IfNotPresent" }}