From e9641f1ec2f657b92a1b39ee3eea5f7cfc2b4f42 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Fri, 13 Oct 2023 03:40:28 +0530 Subject: [PATCH] release sentinel charts Signed-off-by: Shubham Gupta --- charts/redis-sentinel/Chart.yaml | 4 +- charts/redis-sentinel/templates/_helpers.tpl | 63 ++++++++ .../templates/redis-sentinel.yaml | 131 ++++++++++------- charts/redis-sentinel/values.yaml | 136 ++++++++++-------- 4 files changed, 220 insertions(+), 114 deletions(-) create mode 100644 charts/redis-sentinel/templates/_helpers.tpl diff --git a/charts/redis-sentinel/Chart.yaml b/charts/redis-sentinel/Chart.yaml index fbd77da1..c504f29a 100644 --- a/charts/redis-sentinel/Chart.yaml +++ b/charts/redis-sentinel/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: redis-sentinel 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 diff --git a/charts/redis-sentinel/templates/_helpers.tpl b/charts/redis-sentinel/templates/_helpers.tpl new file mode 100644 index 00000000..c918548f --- /dev/null +++ b/charts/redis-sentinel/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/redis-sentinel/templates/redis-sentinel.yaml b/charts/redis-sentinel/templates/redis-sentinel.yaml index 4ac3f041..77508beb 100644 --- a/charts/redis-sentinel/templates/redis-sentinel.yaml +++ b/charts/redis-sentinel/templates/redis-sentinel.yaml @@ -1,20 +1,9 @@ --- -apiVersion: redis.redis.opstreelabs.in/v1beta1 +apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisSentinel 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.redisSentinel.clusterSize }} # Sentinel Config @@ -26,54 +15,86 @@ spec: parallelSyncs: {{ .Values.redisSentinelConfig.parallelSyncs | default "1" | quote}} failoverTimeout: {{ .Values.redisSentinelConfig.failoverTimeout | default "180000" | quote}} downAfterMilliseconds: {{ .Values.redisSentinelConfig.downAfterMilliseconds | default "30000" | quote}} -{{- if eq .Values.externalConfig.enabled true }} + {{- if eq .Values.externalConfig.enabled true }} additionalSentinelConfig: {{ .Release.Name }}-ext-config -{{- end }} -# Kubernetes Config + {{- end }} + kubernetesConfig: image: "{{ .Values.redisSentinel.image }}:{{ .Values.redisSentinel.tag }}" imagePullPolicy: "{{ .Values.redisSentinel.imagePullPolicy }}" - resources: -{{ toYaml .Values.redisSentinel.resources | indent 6 }} -{{- if .Values.redisSentinel.redisSecret }} + {{- if .Values.redisSentinel.imagePullSecrets }} + imagePullSecrets: {{ toYaml .Values.redisSentinel.imagePullSecrets | nindent 4 }} + {{- end }} + {{- if .Values.redisSentinel.resources}} + resources: {{ toYaml .Values.redisSentinel.resources | nindent 6 }} + {{- end }} + {{- if and .Values.redisSentinel.redisSecret.secretName .Values.redisSentinel.redisSecret.secretKey }} redisSecret: - name: "{{ .Values.redisSentinel.redisSecret.secretName }}" - key: "{{ .Values.redisSentinel.redisSecret.secretKey }}" -{{- end }} -{{- if .Values.imagePullSecrets }} - imagePullSecrets: -{{- range $imageSecrets := .Values.imagePullSecrets }} - - name: {{ $imageSecrets.name }} -{{- end }} -{{- end }} + name: "{{ .Values.redisSentinel.redisSecret.secretName | quote }}" + key: "{{ .Values.redisSentinel.redisSecret.secretKey | quote }}" + {{- end }} + {{- if .Values.redisSentinel.ignoreAnnotations}} + ignoreAnnotations: {{ toYaml .Values.redisSentinel.ignoreAnnotations | nindent 6 }} + {{- end }} -{{- if .Values.priorityClassName }} + 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 }} diff --git a/charts/redis-sentinel/values.yaml b/charts/redis-sentinel/values.yaml index 8b10a1c5..e3011901 100644 --- a/charts/redis-sentinel/values.yaml +++ b/charts/redis-sentinel/values.yaml @@ -2,11 +2,13 @@ redisSentinel: clusterSize: 3 image: quay.io/opstree/redis-sentinel - tag: v7.0.7 + 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: @@ -15,19 +17,21 @@ redisSentinel: # limits: # cpu: 100m # memory: 128Mi + ignoreAnnotations: [] + # - "redis.opstreelabs.in/ignore" -# labels: +labels: {} # foo: bar # test: echo redisSentinelConfig: redisReplicationName: "redis-replication" - # masterGroupName: - # redisPort: - # quorum: - # parallelSyncs: - # failoverTimeout: - # downAfterMilliseconds: + masterGroupName: "" + redisPort: "" + quorum: "" + parallelSyncs: "" + failoverTimeout: "" + downAfterMilliseconds: "" externalConfig: enabled: false @@ -49,51 +53,53 @@ serviceMonitor: scrapeTimeout: 10s namespace: monitoring -# redisExporter: -# enabled: false -# image: quay.io/opstree/redis-exporter -# tag: "v1.44.0" -# imagePullPolicy: IfNotPresent -# resources: {} +redisExporter: + enabled: false + image: quay.io/opstree/redis-exporter + tag: "v1.44.0" + imagePullPolicy: IfNotPresent + resources: {} # requests: # cpu: 100m # memory: 128Mi # 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 @@ -112,6 +118,8 @@ podSecurityContext: runAsUser: 1000 fsGroup: 1000 +securityContext : {} + affinity: {} # nodeAffinity: # requiredDuringSchedulingIgnoredDuringExecution: @@ -122,11 +130,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"