Skip to content

Commit

Permalink
add redis chart for latest version
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Gupta <[email protected]>
  • Loading branch information
shubham-cmyk committed Oct 12, 2023
1 parent 571b5ee commit bf0f6ed
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 120 deletions.
2 changes: 1 addition & 1 deletion charts/redis-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: redis-cluster
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
version: 0.15.8
version: 0.15.9
appVersion: "0.15.1"
home: https://github.com/ot-container-kit/redis-operator
sources:
Expand Down
5 changes: 4 additions & 1 deletion charts/redis-cluster/templates/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ spec:
{{- if .Values.redisExporter.resources}}
resources: {{ toYaml .Values.redisExporter.resources | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}

kubernetesConfig:
image: "{{ .Values.redisCluster.image }}:{{ .Values.redisCluster.tag }}"
imagePullPolicy: "{{ .Values.redisCluster.imagePullPolicy }}"
{{- if .Values.redisCluster.imagePullSecrets}}
imagePullSecrets: {{ toYaml .Values.redisCluster.imagePullSecrets | nindent 4 }}
{{- end }}
{{- if .Values.redisExporter.resources}}
{{- if .Values.redisCluster.resources}}
resources: {{ toYaml .Values.redisCluster.resources | nindent 6 }}
{{- end }}
{{- if and .Values.redisCluster.redisSecret.secretName .Values.redisCluster.redisSecret.secretKey }}
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ redisExporter:
# limits:
# cpu: 100m
# memory: 128Mi
env: []
# - name: VAR_NAME
# value: "value1"

sidecars:
name: ""
Expand Down
4 changes: 2 additions & 2 deletions charts/redis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
apiVersion: v2
name: redis
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
version: 0.15.7
appVersion: "0.15.0"
version: 0.15.8
appVersion: "0.15.1"
home: https://github.com/ot-container-kit/redis-operator
sources:
- https://github.com/ot-container-kit/redis-operator
Expand Down
63 changes: 63 additions & 0 deletions charts/redis/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* 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 -}}

{{/* 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 -}}

{{/* 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 -}}
145 changes: 74 additions & 71 deletions charts/redis/templates/redis-standalone.yaml
Original file line number Diff line number Diff line change
@@ -1,83 +1,86 @@
---
apiVersion: redis.redis.opstreelabs.in/v1beta1
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: Redis
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 }}
labels: {{- include "common.labels" . | nindent 4 }}
spec:
{{- if eq .Values.externalConfig.enabled true }}
redisConfig:
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.env }}
env:
{{ toYaml .Values.redisExporter.env | indent 4 }}
{{- end }}
kubernetesConfig:
image: "{{ .Values.redisStandalone.image }}:{{ .Values.redisStandalone.tag }}"
imagePullPolicy: "{{ .Values.redisStandalone.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisStandalone.resources | indent 6 }}
{{- if .Values.redisStandalone.redisSecret }}
{{- if .Values.redisStandalone.imagePullSecrets }}
imagePullSecrets: {{ toYaml .Values.redisStandalone.imagePullSecrets | nindent 4 }}
{{- end }}
{{- if .Values.redisStandalone.resources}}
resources: {{ toYaml .Values.redisStandalone.resources | nindent 6 }}
{{- end }}
{{- if and .Values.redisStandalone.redisSecret.secretName .Values.redisStandalone.redisSecret.secretKey }}
redisSecret:
name: "{{ .Values.redisStandalone.redisSecret.secretName }}"
key: "{{ .Values.redisStandalone.redisSecret.secretKey }}"
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range $imageSecrets := .Values.imagePullSecrets }}
- name: {{ $imageSecrets.name }}
{{- end }}
{{- end }}
{{- if .Values.storageSpec }}
storage:
{{ toYaml .Values.storageSpec | indent 4 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 4 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 4 }}
{{- end }}
{{- if .Values.podSecurityContext }}
podSecurityContext:
{{ toYaml .Values.podSecurityContext | indent 4 }}
name: "{{ .Values.redisStandalone.redisSecret.secretName | quote }}"
key: "{{ .Values.redisStandalone.redisSecret.secretKey | quote }}"
{{- end }}
{{- if .Values.redisStandalone.ignoreAnnotations}}
ignoreAnnotations: {{ toYaml .Values.redisStandalone.ignoreAnnotations | nindent 6 }}
{{- end }}

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

{{- if .Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: "{{ .Release.Name }}-ext-config"
{{- end }}
{{- if .Values.storageSpec }}
storage: {{ toYaml .Values.storageSpec | nindent 4 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 4 }}
{{- end }}
{{- if .Values.podSecurityContext }}
podSecurityContext: {{ toYaml .Values.podSecurityContext | nindent 4 }}
{{- end }}
{{- if .Values.securityContext }}
securityContext: {{ toYaml .Values.securityContext | nindent 4 }}
{{- end }}
{{- if and .Values.priorityClassName (ne .Values.priorityClassName "") }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.affinity }}
affinity: {{ toYaml .Values.affinity | nindent 4 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations: {{ toYaml .Values.tolerations | 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.initContainers .Values.initContainer.enabled (ne .Values.initContainers.name "") (ne .Values.initContainers.image) }}
initContainers: {{ include "initContainer.properties" | nindent 4 }}
{{- end }}
{{- if and .Values.sidecars (ne .Values.sidecars.name "") (ne .Values.sidecars.image) }}
sidecars: {{ include "sidecar.properties" | nindent 4 }}
{{- end }}
{{- if and .Values.serviceAccountName (ne .Values.serviceAccountName "") }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
{{- end }}
{{- end }}
{{- if .Values.env }}
env: {{ toYaml .Values.env | nindent 4 }}
{{- end }}
Loading

0 comments on commit bf0f6ed

Please sign in to comment.