fix: incorrect redis config (#6405)

fix: incorrect redis config (#2130)

Signed-off-by: hongming <coder.scala@gmail.com>
Co-authored-by: hongming <coder.scala@gmail.com>
This commit is contained in:
KubeSphere CI Bot
2025-03-11 10:25:48 +08:00
committed by GitHub
parent e48875411d
commit 81c74f28d4

View File

@@ -2,14 +2,18 @@
{{- if lookup "v1" "Secret" "kubesphere-system" "redis-secret" }}
{{- lookup "v1" "Secret" "kubesphere-system" "redis-secret" | toYaml }}
{{- else }}
{{- $auth := randAlphaNum 15 }}
apiVersion: v1
kind: Secret
metadata:
name: redis-secret
namespace: kubesphere-system
type: Opaque
data:
auth: {{ randAlphaNum 15 | b64enc }}
stringData:
auth: {{ $auth | quote }}
redis.conf: |
requirepass {{ $auth }}
masterauth {{ $auth }}
port {{ .Values.redis.port | default 6379 }}
{{- end }}
{{- end }}
@@ -20,27 +24,21 @@ kind: Deployment
metadata:
labels:
app: redis
tier: database
version: redis-4.0
name: redis
namespace: kubesphere-system
spec:
replicas: {{ .Values.redis.replicaCount }}
selector:
matchLabels:
app: redis
tier: database
template:
metadata:
labels:
app: redis
tier: database
version: redis-4.0
spec:
containers:
- image: {{ template "redis.image" . }}
imagePullPolicy: {{ .Values.redis.image.pullPolicy }}
command: ['sh', '-c', 'cat /tmp/redis/redis.conf | sed "s/REDIS_PASSWORD/$KUBESPHERE_CACHE_OPTIONS_PASSWORD/" > /data/redis.conf | redis-server /data/redis.conf']
command: ['sh', '-c', 'redis-server /etc/redis/redis.conf']
name: redis
args: ["/data/redis.conf"]
env:
@@ -51,7 +49,8 @@ spec:
key: auth
volumeMounts:
- name: redis-config
mountPath: "/tmp/redis"
mountPath: "/etc/redis/redis.conf"
subPath: redis.conf
readOnly: true
{{- if .Values.redis.persistentVolume.enabled }}
- mountPath: /data
@@ -70,8 +69,8 @@ spec:
memory: 100Mi
volumes:
- name: redis-config
configMap:
name: redis-configmap
secret:
secretName: redis-secret
{{- if .Values.redis.persistentVolume.enabled }}
- name: redis-pvc
persistentVolumeClaim:
@@ -94,20 +93,6 @@ spec:
{{- if .Values.tolerations }}
tolerations: {{- toYaml .Values.tolerations | nindent 8 }}{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-configmap
labels:
app: redis
tier: database
version: redis-4.0
data:
redis.conf: |
requirepass REDIS_PASSWORD
masterauth REDIS_PASSWORD
port {{ .Values.redis.port | default 6379 }}
---
apiVersion: v1
@@ -115,9 +100,7 @@ kind: Service
metadata:
labels:
app: redis
tier: database
name: redis
namespace: kubesphere-system
spec:
ports:
- name: redis
@@ -126,7 +109,6 @@ spec:
targetPort: {{ .Values.redis.port | default 6379 }}
selector:
app: redis
tier: database
sessionAffinity: None
type: ClusterIP
@@ -136,7 +118,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-pvc
namespace: kubesphere-system
spec:
accessModes:
- ReadWriteOnce