Skip to content

Commit d9e0739

Browse files
committed
feat(redis): change redis to statefulset
1 parent 4f11798 commit d9e0739

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

charts/redis/templates/logger-redis-secret-creds.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ metadata:
77
heritage: drycc
88
annotations:
99
"helm.sh/hook": pre-install
10-
data: {{ if eq .Values.global.logger_redis_location "on-cluster"}}
11-
password: {{ randAlphaNum 32 | b64enc }}{{ else if eq .Values.global.logger_redis_location "off-cluster"}}
12-
db: {{ .Values.db | b64enc }}
10+
data:
11+
{{ if eq .Values.global.logger_redis_location "on-cluster"}}
12+
password: {{ randAlphaNum 32 | b64enc }}
13+
{{ else if eq .Values.global.logger_redis_location "off-cluster"}}
14+
addrs: {{ .Values.addrs | b64enc }}
1315
password: {{ .Values.password | b64enc }}
14-
host: {{ .Values.host | b64enc }}
15-
port: {{ .Values.port | b64enc }}{{ end }}
16+
{{ end }}

charts/redis/templates/logger-redis-deployment.yaml renamed to charts/redis/templates/logger-redis-statefulset.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{{- if eq .Values.global.logger_redis_location "on-cluster" }}
22
apiVersion: apps/v1
3-
kind: Deployment
3+
kind: StatefulSet
44
metadata:
55
name: drycc-logger-redis
66
labels:
77
heritage: drycc
88
annotations:
99
component.drycc.cc/version: {{ .Values.docker_tag }}
1010
spec:
11-
replicas: 1
12-
strategy:
13-
type: Recreate
11+
serviceName: drycc-logger-redis
12+
replicas: {{ .Values.replicas }}
1413
selector:
1514
matchLabels:
1615
app: drycc-logger-redis
@@ -33,8 +32,9 @@ spec:
3332
memory: {{.Values.limits_memory}}
3433
{{- end}}
3534
{{- end}}
35+
command: ["/bin/boot", "--port", "{{.Values.port}}"]
3636
ports:
37-
- containerPort: 6379
37+
- containerPort: {{.Values.port}}
3838
volumeMounts:
3939
- name: logger-redis-creds
4040
mountPath: /var/run/secrets/drycc/redis/creds

charts/redis/templates/logger-redis-service.yaml renamed to charts/redis/templates/logger-redis-svc.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ kind: Service
44
metadata:
55
name: drycc-logger-redis
66
labels:
7-
heritage: helm
7+
heritage: drycc
88
spec:
9+
clusterIP: None
910
selector:
1011
app: drycc-logger-redis
1112
ports:
12-
- port: 6379
13+
- port: {{.Values.port}}
1314
{{- end }}

charts/redis/values.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ global:
1313
# - off-cluster: Run Redis outside the Kubernetes cluster (configure in loggerRedis section)
1414
logger_redis_location: "on-cluster"
1515

16-
# Configure the following ONLY if using an off-cluster Redis instance for logger
17-
db: "0"
18-
host: "redis host"
19-
port: "redis port"
16+
# The following parameters are configured only when using an on-cluster Redis instance for logger
17+
replicas: 1
18+
port: "6379"
19+
20+
# The following parameters are configured only when using an off-cluster Redis instance for logger
21+
addrs: "" # A list of clusters: "127.0.0.1:7001/1,127.0.0.2:7002/1"
2022
password: "redis password" # "" == no password

rootfs/bin/boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ if [ -e $REDIS_PASSWORD_FILE ]; then
1313
fi
1414
fi
1515

16-
exec redis-server $REDIS_CONFIG_FILE
16+
exec redis-server $REDIS_CONFIG_FILE "$@"

0 commit comments

Comments
 (0)