Skip to content

Commit

Permalink
redis replication charts
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 bf0f6ed commit 6f0dd52
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 126 deletions.
4 changes: 2 additions & 2 deletions charts/redis-replication/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ maintainers:
- name: shubham-cmyk
sources:
- https://github.com/ot-container-kit/redis-operator
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
keywords:
- operator
Expand Down
63 changes: 63 additions & 0 deletions charts/redis-replication/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: 75 additions & 70 deletions charts/redis-replication/templates/redis-replication.yaml
Original file line number Diff line number Diff line change
@@ -1,83 +1,88 @@
---
apiVersion: redis.redis.opstreelabs.in/v1beta1
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisReplication
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:
clusterSize: {{ .Values.redisReplication.clusterSize }}
{{- 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.redisReplication.image }}:{{ .Values.redisReplication.tag }}"
imagePullPolicy: "{{ .Values.redisReplication.imagePullPolicy }}"
resources:
{{ toYaml .Values.redisReplication.resources | indent 6 }}
{{- if .Values.redisReplication.redisSecret }}
{{- if .Values.redisReplication.imagePullSecrets }}
imagePullSecrets: {{ toYaml .Values.redisReplication.imagePullSecrets | nindent 4 }}
{{- end }}
{{- if .Values.redisReplication.resources}}
resources: {{ toYaml .Values.redisReplication.resources | nindent 6 }}
{{- end }}
{{- if and .Values.redisReplication.redisSecret.secretName .Values.redisReplication.redisSecret.secretKey }}
redisSecret:
name: "{{ .Values.redisReplication.redisSecret.secretName }}"
key: "{{ .Values.redisReplication.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 }}
name: "{{ .Values.redisReplication.redisSecret.secretName | quote }}"
key: "{{ .Values.redisReplication.redisSecret.secretKey | quote }}"
{{- end }}
{{- if .Values.redisReplication.ignoreAnnotations}}
ignoreAnnotations: {{ toYaml .Values.redisReplication.ignoreAnnotations | nindent 6 }}
{{- end }}

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.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 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 4 }}
{{- end }}
{{- if .Values.TLS }}
{{- 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 }}

121 changes: 67 additions & 54 deletions charts/redis-replication/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
redisReplication:
clusterSize: 3
image: quay.io/opstree/redis
tag: v7.0.5
tag: v7.0.12
imagePullPolicy: IfNotPresent
# redisSecret:
# secretName: redis-secret
# secretKey: password
imagePullSecrets: []
# - name: Secret with Registry credentials
redisSecret:
secretName: ""
secretKey: ""
serviceType: ClusterIP
resources: {}
# requests:
Expand All @@ -15,8 +17,10 @@ redisReplication:
# limits:
# cpu: 100m
# memory: 128Mi
ignoreAnnotations: []
# - "redis.opstreelabs.in/ignore"

# labels:
labels: {}
# foo: bar
# test: echo

Expand Down Expand Up @@ -52,39 +56,41 @@ redisExporter:
# limits:
# cpu: 100m
# memory: 128Mi
# env:
# - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
# value: "true"
# - name: UI_PROPERTIES_FILE_NAME
# valueFrom:
# configMapKeyRef:
# name: game-demo
# key: ui_properties_file_name
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username

sidecars: []
# - name: "sidecar1"
# image: "image:1.0"
# imagePullPolicy: Always
# resources:
# limits:
# cpu: 50m
# memory: 64Mi
# requests:
# cpu: 10m
# memory: 32M
# env:
# - name: VAR_NAME
# value: "value1"

# priorityClassName: "-"

# imagePullSecrets:
# - name: regcred
env: []
# - name: VAR_NAME
# value: "value1"

initContainer:
enabled: false
image: ""
imagePullPolicy: "IfNotPresent"
resources: {}
# requests:
# memory: "64Mi"
# cpu: "250m"
# limits:
# memory: "128Mi"
# cpu: "500m"
env: []
command: []
args: []

sidecars:
name: ""
image: ""
imagePullPolicy: "IfNotPresent"
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "50m"
memory: "64Mi"
env: []
# - name: MY_ENV_VAR
# value: "my-env-var-value"

priorityClassName: ""

nodeSelector: {}
# memory: medium
Expand All @@ -97,21 +103,14 @@ storageSpec:
resources:
requests:
storage: 1Gi
# volumemount:
# volume:
# - name: example-config
# configMap:
# name: example-configmap
# mount:
# - mountPath: /config
# name: example-config

# selector: {}

podSecurityContext:
runAsUser: 1000
fsGroup: 1000

securityContext : {}

affinity: {}
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -122,11 +121,25 @@ affinity: {}
# values:
# - ssd

# serviceAccountName: redis-sa
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"

serviceAccountName : ""

TLS:
ca: ca.key
cert: tls.crt
key: tls.key
secret:
secretName: ""

acl :
secret :
secretName: ""

# TLS:
# ca: ca.key
# cert: tls.crt
# key: tls.key
# secret:
# secretName: redis-tls-cert
env : []
# - name: VAR_NAME
# value: "value1"

0 comments on commit 6f0dd52

Please sign in to comment.