Skip to content

Commit

Permalink
[ Release] : Helm chart v0.15.1 Redis Cluster and Redis Operator (#141)
Browse files Browse the repository at this point in the history
* fix operator chart

Signed-off-by: Shubham Gupta <[email protected]>

* update crds

Signed-off-by: Shubham Gupta <[email protected]>

* fix operator

Signed-off-by: Shubham Gupta <[email protected]>

* quick release for app verison v0.15.1

Signed-off-by: Shubham Gupta <[email protected]>

* bump chart

Signed-off-by: Shubham Gupta <[email protected]>

---------

Signed-off-by: Shubham Gupta <[email protected]>
  • Loading branch information
shubham-cmyk authored Sep 29, 2023
1 parent 50a7aa7 commit 2be4a0f
Show file tree
Hide file tree
Showing 18 changed files with 746 additions and 209 deletions.
4 changes: 2 additions & 2 deletions charts/redis-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: redis-cluster
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
version: 0.15.3
appVersion: "0.15.0"
version: 0.15.5
appVersion: "0.15.1"
home: https://github.com/ot-container-kit/redis-operator
sources:
- https://github.com/ot-container-kit/redis-operator
Expand Down
82 changes: 82 additions & 0 deletions charts/redis-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{/* vim: set filetype=mustache: */}}

{{/* Define common labels */}}
{{- define "common.labels" -}}
app.kubernetes.io/name: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- if .Values.labels }}
{{- range $labelkey, $labelvalue := .Values.labels }}
{{ $labelkey}}: {{ $labelvalue }}
{{- end }}
{{- end }}
{{- end -}}

{{/* Helper for Redis Cluster (leader & follower) */}}
{{- define "redis.role" -}}
{{- with .affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .pdb.enabled }}
pdb:
enabled: "{{ .pdb.enabled | quote }}"
maxUnavailable: {{ .pdb.maxUnavailable }}
minAvailable: {{ .pdb.minUnavailable }}
{{- end }}
{{- if .nodeSelector }}
nodeSelector:
{{- toYaml .nodeSelector | nindent 4 }}
{{- end }}
{{- end -}}

{{/* Generate sidecar properties */}}
{{- define "sidecar.properties" -}}
{{- with .Values.sidecars }}
name: {{ .name }}
image: {{ .image }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
{{- if .resources }}
resources:
{{ toYaml .resources | nindent 2 }}
{{- end }}
{{- if .env }}
env:
{{ toYaml .env | nindent 2 }}
{{- end }}
{{- end }}
{{- end -}}

{{/* Generate init container properties */}}
{{- define "initContainer.properties" -}}
{{- with .Values.initContainer }}
{{- if .enabled }}
image: {{ .image }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
{{- if .resources }}
resources:
{{ toYaml .resources | nindent 2 }}
{{- end }}
{{- if .env }}
env:
{{ toYaml .env | nindent 2 }}
{{- end }}
{{- if .command }}
command:
{{ toYaml .command | nindent 2 }}
{{- end }}
{{- if .args }}
args:
{{ toYaml .args | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

151 changes: 61 additions & 90 deletions charts/redis-cluster/templates/redis-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,82 @@
---
apiVersion: redis.redis.opstreelabs.in/v1beta1
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisCluster
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- if .Values.labels }}
{{- range $labelkey, $labelvalue := .Values.labels }}
{{ $labelkey}}: {{ $labelvalue }}
{{- end }}
{{- end }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 6 }}
{{- end }}
labels: {{- include "common.labels" . | nindent 4 }}
spec:
clusterSize: {{ .Values.redisCluster.clusterSize }}
persistenceEnabled: {{ .Values.redisCluster.persistenceEnabled }}
clusterVersion: {{ .Values.redisCluster.clusterVersion }}
redisLeader:
{{- if .Values.redisCluster.leader.affinity }}
affinity:
{{ toYaml .Values.redisCluster.leader.affinity | nindent 6 }}
{{- end }}
replicas: {{ .Values.redisCluster.leader.replicas }}
{{- if eq .Values.externalConfig.enabled true }}

redisLeader: {{- include "redis.role" .Values.redisCluster.leader | nindent 4 }}
replicas: {{ .Values.redisCluster.leader.replicas}}
{{- if .Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: {{ .Release.Name }}-ext-config
{{- end }}
{{- if eq .Values.pdb.enabled true }}
pdb:
enabled: {{ .Values.pdb.enabled }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- end }}
{{- end }}
redisFollower:
{{- if .Values.redisCluster.follower.affinity }}
affinity:
{{ toYaml .Values.redisCluster.follower.affinity | nindent 6 }}
{{- end }}
replicas: {{ .Values.redisCluster.follower.replicas }}
{{- if eq .Values.externalConfig.enabled true }}
additionalRedisConfig: "{{ .Release.Name }}-ext-config"
{{- end }}

redisFollower: {{- include "redis.role" .Values.redisCluster.follower | nindent 4 }}
replicas: {{ .Values.redisCluster.follower.replicas}}
{{- if .Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: {{ .Release.Name }}-ext-config
{{- end }}
{{- if eq .Values.pdb.enabled true }}
pdb:
enabled: {{ .Values.pdb.enabled }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- end }}
{{- end }}
additionalRedisConfig: "{{ .Release.Name }}-ext-config"
{{- end }}

redisExporter:
enabled: {{ .Values.redisExporter.enabled }}
image: "{{ .Values.redisExporter.image }}:{{ .Values.redisExporter.tag }}"
imagePullPolicy: "{{ .Values.redisExporter.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisExporter.resources | indent 6 }}
{{- if .Values.redisExporter.resources}}
resources: {{ toYaml .Values.redisExporter.resources | nindent 6 }}
{{- end }}

kubernetesConfig:
image: "{{ .Values.redisCluster.image }}:{{ .Values.redisCluster.tag }}"
imagePullPolicy: "{{ .Values.redisCluster.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisCluster.resources | indent 6 }}
{{- if .Values.redisCluster.redisSecret }}
{{- if .Values.redisCluster.imagePullSecrets}}
imagePullSecrets: {{ toYaml .Values.redisCluster.imagePullSecrets | nindent 4 }}
{{- end }}
{{- if .Values.redisExporter.resources}}
resources: {{ toYaml .Values.redisCluster.resources | nindent 6 }}
{{- end }}
{{- if and .Values.redisCluster.redisSecret.secretName .Values.redisCluster.redisSecret.secretKey }}
redisSecret:
name: "{{ .Values.redisCluster.redisSecret.secretName }}"
key: "{{ .Values.redisCluster.redisSecret.secretKey }}"
{{- end }}
{{- if .Values.storageSpec }}
storage:
{{ toYaml .Values.storageSpec | indent 4 }}
{{- end }}
{{- if .Values.priorityClassName }}
name: "{{ .Values.redisCluster.redisSecret.secretName | quote }}"
key: "{{ .Values.redisCluster.redisSecret.secretKey | quote }}"
{{- end }}

{{- if .Values.storageSpec }}
storage: {{ toYaml .Values.storageSpec | nindent 4 }}
{{- end }}
{{- if and .Values.priorityClassName (ne .Values.priorityClassName "") }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 4 }}
{{- end }}
{{- if .Values.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.podSecurityContext | indent 4 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 4 }}
{{- end }}
{{- if .Values.TLS }}
{{- end }}
{{- if .Values.podSecurityContext }}
podSecurityContext: {{ toYaml .Values.podSecurityContext | nindent 4 }}
{{- end }}
{{- if and .Values.TLS.ca .Values.TLS.cert .Values.TLS.key .Values.TLS.secret.secretName }}
TLS:
{{ toYaml .Values.TLS | indent 4 }}
{{- end}}
{{- if .Values.sidecars }}
sidecars:
{{ toYaml .Values.sidecars | indent 4 }}
{{- end }}
{{- if .Values.serviceAccountName }}
ca: {{ .Values.TLS.ca | quote }}
cert: {{ .Values.TLS.cert | quote }}
key: {{ .Values.TLS.key | quote }}
secret:
secretName: {{ .Values.TLS.secret.secretName | quote }}
{{- end }}
{{- if and .Values.acl.secret (ne .Values.acl.secret.secretName "") }}
acl:
secret:
secretName: {{ .Values.acl.secret.secretName | quote }}
{{- end }}
{{- if and .Values.sidecars (ne .Values.sidecars.name "") (ne .Values.sidecars.image) }}
sidecars: {{ include "sidecar.properties" | nindent 4 }}
{{- end }}
{{- if and .Values.initContainers .Values.initContainer.enabled (ne .Values.initContainers.name "") (ne .Values.initContainers.image) }}
initContainers: {{ include "initContainer.properties" | nindent 4 }}
{{- end }}
{{- if .Values.env }}
env: {{ toYaml .Values.env | nindent 4 }}
{{- end }}
{{- if and .Values.serviceAccountName (ne .Values.serviceAccountName "") }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
{{- end }}
{{- end }}
Loading

0 comments on commit 2be4a0f

Please sign in to comment.