[bitnami/redis] Allow to change Workload as StatefulSet or Deployment (#8846)

* [bitnami/redis] Allow to change Workload as StatefulSet or Deployment

Signed-off-by: David Girón <contacto@duhowpi.net>

* Add persistence for Deployment

Signed-off-by: David Girón <contacto@duhowpi.net>
This commit is contained in:
David Girón
2022-02-09 10:39:51 +01:00
committed by GitHub
parent 4fb5ae31aa
commit 74a9a673b9
6 changed files with 50 additions and 2 deletions
+1 -1
View File
@@ -24,4 +24,4 @@ maintainers:
name: redis
sources:
- https://github.com/bitnami/bitnami-docker-redis
version: 16.3.1
version: 16.4.0
+1
View File
@@ -160,6 +160,7 @@ The command removes all the Kubernetes components associated with the chart and
| `master.podSecurityContext.fsGroup` | Set Redis&trade; master pod's Security Context fsGroup | `1001` |
| `master.containerSecurityContext.enabled` | Enabled Redis&trade; master containers' Security Context | `true` |
| `master.containerSecurityContext.runAsUser` | Set Redis&trade; master containers' Security Context runAsUser | `1001` |
| `master.kind` | Use either Deployment or StatefulSet (default) | `StatefulSet` |
| `master.schedulerName` | Alternate scheduler for Redis&trade; master pods | `""` |
| `master.updateStrategy.type` | Redis&trade; master statefulset strategy type | `RollingUpdate` |
| `master.priorityClassName` | Redis&trade; master pods' priorityClassName | `""` |
@@ -1,6 +1,6 @@
{{- if or (not (eq .Values.architecture "replication")) (not .Values.sentinel.enabled) }}
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet
kind: {{ .Values.master.kind }}
metadata:
name: {{ printf "%s-master" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }}
@@ -17,10 +17,16 @@ spec:
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: master
{{- if (eq .Values.master.kind "StatefulSet") }}
serviceName: {{ printf "%s-headless" (include "common.names.fullname" .) }}
{{- end }}
{{- if .Values.master.updateStrategy }}
{{- if (eq .Values.master.kind "Deployment") }}
strategy: {{- toYaml .Values.master.updateStrategy | nindent 4 }}
{{- else }}
updateStrategy: {{- toYaml .Values.master.updateStrategy | nindent 4 }}
{{- end }}
{{- end }}
template:
metadata:
labels: {{- include "common.labels.standard" . | nindent 8 }}
@@ -422,6 +428,10 @@ spec:
- name: redis-data
persistentVolumeClaim:
claimName: {{ printf "%s" (tpl .Values.master.persistence.existingClaim .) }}
{{- else if (eq .Values.master.kind "Deployment") }}
- name: redis-data
persistentVolumeClaim:
claimName: {{ printf "redis-data-%s-master" (include "common.names.fullname" .) }}
{{- else }}
volumeClaimTemplates:
- metadata:
+26
View File
@@ -0,0 +1,26 @@
{{- if and (eq .Values.architecture "standalone") (eq .Values.master.kind "Deployment") (.Values.master.persistence.enabled) (not .Values.master.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ printf "redis-data-%s-master" (include "common.names.fullname" .) }}
labels: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: master
{{- if .Values.master.persistence.annotations }}
annotations: {{- toYaml .Values.master.persistence.annotations | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.master.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.master.persistence.size | quote }}
{{- if .Values.master.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.master.persistence.selector "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.master.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.master.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.master.persistence "global" .Values.global) | nindent 4 }}
{{- end }}
+7
View File
@@ -36,6 +36,13 @@
"title": "Master replicas settings",
"form": true,
"properties": {
"kind": {
"type": "string",
"title": "Workload Kind",
"form": true,
"description": "Allowed values: `Deployment` or `StatefulSet`",
"enum": ["Deployment", "StatefulSet"]
},
"persistence": {
"type": "object",
"title": "Persistence for master replicas",
+4
View File
@@ -262,6 +262,10 @@ master:
containerSecurityContext:
enabled: true
runAsUser: 1001
## @param master.kind Use either Deployment or StatefulSet (default)
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
##
kind: StatefulSet
## @param master.schedulerName Alternate scheduler for Redis&trade; master pods
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##