first commit
This commit is contained in:
90
notely/templates/redis-deployment.yaml
Normal file
90
notely/templates/redis-deployment.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
{{- if .Values.redis.enabled }}
|
||||
{{- $redisUser := .Values.secrets.redisUser | default "" }}
|
||||
{{- $redisPassword := .Values.secrets.redisPassword | default "" }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "notely.redis.fullname" . }}
|
||||
labels:
|
||||
{{- include "notely.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "notely.name" . }}-redis
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "notely.name" . }}-redis
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.redis.image.pullPolicy }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "notely.fullname" . }}-secrets
|
||||
{{- if .Values.redis.auth.enabled }}
|
||||
{{- if $redisUser }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
cat <<EOF > /tmp/users.acl
|
||||
user default off
|
||||
user ${REDIS_USER} on >${REDIS_PASSWORD} ~* &* +@all
|
||||
EOF
|
||||
exec redis-server --aclfile /tmp/users.acl
|
||||
{{- else }}
|
||||
command:
|
||||
- redis-server
|
||||
- --requirepass
|
||||
- {{ required "secrets.redisPassword must be set when redis.auth.enabled=true" $redisPassword | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.redis.service.port }}
|
||||
name: redis
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
{{- if .Values.redis.auth.enabled }}
|
||||
{{- if $redisUser }}
|
||||
- sh
|
||||
- -c
|
||||
- redis-cli --user "$REDIS_USER" -a "$REDIS_PASSWORD" ping
|
||||
{{- else }}
|
||||
- sh
|
||||
- -c
|
||||
- redis-cli -a "$REDIS_PASSWORD" ping
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- redis-cli
|
||||
- ping
|
||||
{{- end }}
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
{{- if .Values.redis.auth.enabled }}
|
||||
{{- if $redisUser }}
|
||||
- sh
|
||||
- -c
|
||||
- redis-cli --user "$REDIS_USER" -a "$REDIS_PASSWORD" ping
|
||||
{{- else }}
|
||||
- sh
|
||||
- -c
|
||||
- redis-cli -a "$REDIS_PASSWORD" ping
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- redis-cli
|
||||
- ping
|
||||
{{- end }}
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.redis.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user