From 452b2c945700207cc51f90a66fe1710de2686c76 Mon Sep 17 00:00:00 2001 From: EStork09 Date: Wed, 18 Oct 2023 14:20:55 +0200 Subject: [PATCH] Added name overwrite function to redis charts (#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix redis-sentinel selector role value (#164) * fix redis-sentinel selector role value Signed-off-by: whzghb <631064936@qq.com> * fix lints Signed-off-by: Shubham Gupta * fix linl-2 Signed-off-by: Shubham Gupta --------- Signed-off-by: whzghb <631064936@qq.com> Signed-off-by: Shubham Gupta Co-authored-by: Shubham Gupta Signed-off-by: EStork09 * Added name overwrite function to redis charts Signed-off-by: EStork09 * Bumpped versions Signed-off-by: EStork09 * Moved fields for name under specific configuration Signed-off-by: EStork09 * Adjusted values.yaml to address linting report Signed-off-by: EStork09 * Addressed linting errors Signed-off-by: EStork09 --------- Signed-off-by: whzghb <631064936@qq.com> Signed-off-by: Shubham Gupta Signed-off-by: EStork09 Co-authored-by: whzghb <41436057+whzghb@users.noreply.github.com> Co-authored-by: Shubham Gupta Signed-off-by: Sébastien HO --- charts/redis-cluster/Chart.yaml | 2 +- charts/redis-cluster/README.md | 1 + charts/redis-cluster/templates/_helpers.tpl | 4 ++-- charts/redis-cluster/templates/extra-config.yaml | 6 +++--- .../templates/follower-service.yaml | 8 ++++---- charts/redis-cluster/templates/follower-sm.yaml | 8 ++++---- .../redis-cluster/templates/leader-service.yaml | 8 ++++---- charts/redis-cluster/templates/leader-sm.yaml | 8 ++++---- .../redis-cluster/templates/redis-cluster.yaml | 6 +++--- charts/redis-cluster/values.yaml | 15 ++++++++------- charts/redis-replication/Chart.yaml | 2 +- .../templates/extra-config.yaml | 6 +++--- .../templates/redis-replication.yaml | 4 ++-- .../templates/replication-service.yaml | 8 ++++---- .../templates/servicemonitor.yaml | 8 ++++---- charts/redis-replication/values.yaml | 16 ++++++++++------ charts/redis-sentinel/Chart.yaml | 2 +- .../redis-sentinel/templates/extra-config.yaml | 6 +++--- .../redis-sentinel/templates/redis-sentinel.yaml | 6 +++--- charts/redis-sentinel/templates/service.yaml | 8 ++++---- charts/redis-sentinel/values.yaml | 4 ++++ charts/redis/Chart.yaml | 2 +- charts/redis/README.md | 1 + charts/redis/templates/_helpers.tpl | 4 ++-- charts/redis/templates/extra-config.yaml | 6 +++--- charts/redis/templates/redis-standalone.yaml | 4 ++-- charts/redis/templates/service.yaml | 8 ++++---- charts/redis/templates/servicemonitor.yaml | 8 ++++---- charts/redis/values.yaml | 15 ++++++++------- 29 files changed, 98 insertions(+), 86 deletions(-) diff --git a/charts/redis-cluster/Chart.yaml b/charts/redis-cluster/Chart.yaml index c49e1704..cfe4e8a0 100644 --- a/charts/redis-cluster/Chart.yaml +++ b/charts/redis-cluster/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: redis-cluster description: Provides easy redis setup definitions for Kubernetes services, and deployment. -version: 0.15.9 +version: 0.15.10 appVersion: "0.15.1" home: https://github.com/ot-container-kit/redis-operator sources: diff --git a/charts/redis-cluster/README.md b/charts/redis-cluster/README.md index a74dc34f..73363700 100644 --- a/charts/redis-cluster/README.md +++ b/charts/redis-cluster/README.md @@ -43,6 +43,7 @@ helm delete --namespace | `redisCluster.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | | `redisCluster.leaderServiceType` | ClusterIP | Kubernetes service type for Redis Leader | | `redisCluster.followerServiceType` | ClusterIP | Kubernetes service type for Redis Follower | +| `redisCluster.name` | "" | Overwrites the name for the charts resources instead of the Release name | | `externalService.enabled` | false | If redis service needs to be exposed using LoadBalancer or NodePort | | `externalService.annotations` | {} | Kubernetes service related annotations | | `externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | diff --git a/charts/redis-cluster/templates/_helpers.tpl b/charts/redis-cluster/templates/_helpers.tpl index cb9c07a7..0dd154eb 100644 --- a/charts/redis-cluster/templates/_helpers.tpl +++ b/charts/redis-cluster/templates/_helpers.tpl @@ -2,10 +2,10 @@ {{/* Define common labels */}} {{- define "common.labels" -}} -app.kubernetes.io/name: {{ .Release.Name }} +app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware {{- if .Values.labels }} diff --git a/charts/redis-cluster/templates/extra-config.yaml b/charts/redis-cluster/templates/extra-config.yaml index e751f561..755c4d36 100644 --- a/charts/redis-cluster/templates/extra-config.yaml +++ b/charts/redis-cluster/templates/extra-config.yaml @@ -3,12 +3,12 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-ext-config + name: {{ .Values.redisCluster.name | default .Release.Name }}-ext-config labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware data: diff --git a/charts/redis-cluster/templates/follower-service.yaml b/charts/redis-cluster/templates/follower-service.yaml index 8147a444..6fa64552 100644 --- a/charts/redis-cluster/templates/follower-service.yaml +++ b/charts/redis-cluster/templates/follower-service.yaml @@ -3,22 +3,22 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-follower-external-service + name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-external-service {{- if .Values.externalService.annotations }} annotations: {{ toYaml .Values.externalService.annotations | indent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: type: {{ .Values.externalService.serviceType }} selector: - app: {{ .Release.Name }}-follower + app: {{ .Values.redisCluster.name | default .Release.Name }}-follower redis_setup_type: cluster role: follower ports: diff --git a/charts/redis-cluster/templates/follower-sm.yaml b/charts/redis-cluster/templates/follower-sm.yaml index 18ffaead..c1f19977 100644 --- a/charts/redis-cluster/templates/follower-sm.yaml +++ b/charts/redis-cluster/templates/follower-sm.yaml @@ -3,18 +3,18 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Release.Name }}-follower-prometheus-monitoring + name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-prometheus-monitoring labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: selector: matchLabels: - app: {{ .Release.Name }}-follower + app: {{ .Values.redisCluster.name | default .Release.Name }}-follower redis_setup_type: cluster role: follower endpoints: diff --git a/charts/redis-cluster/templates/leader-service.yaml b/charts/redis-cluster/templates/leader-service.yaml index 05f459ac..e7cedd86 100644 --- a/charts/redis-cluster/templates/leader-service.yaml +++ b/charts/redis-cluster/templates/leader-service.yaml @@ -3,22 +3,22 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-leader-external-service + name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-external-service {{- if .Values.externalService.annotations }} annotations: {{ toYaml .Values.externalService.annotations | indent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: type: {{ .Values.externalService.serviceType }} selector: - app: {{ .Release.Name }}-leader + app: {{ .Values.redisCluster.name | default .Release.Name }}-leader redis_setup_type: cluster role: leader ports: diff --git a/charts/redis-cluster/templates/leader-sm.yaml b/charts/redis-cluster/templates/leader-sm.yaml index 58d4f2a0..1fabfab1 100644 --- a/charts/redis-cluster/templates/leader-sm.yaml +++ b/charts/redis-cluster/templates/leader-sm.yaml @@ -3,18 +3,18 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Release.Name }}-leader-prometheus-monitoring + name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-prometheus-monitoring labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisCluster.name | default .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/instance: {{ .Values.redisCluster.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: selector: matchLabels: - app: {{ .Release.Name }}-leader + app: {{ .Values.redisCluster.name | default .Release.Name }}-leader redis_setup_type: cluster role: leader endpoints: diff --git a/charts/redis-cluster/templates/redis-cluster.yaml b/charts/redis-cluster/templates/redis-cluster.yaml index 5cf55ba5..a8140e7b 100644 --- a/charts/redis-cluster/templates/redis-cluster.yaml +++ b/charts/redis-cluster/templates/redis-cluster.yaml @@ -2,7 +2,7 @@ apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: - name: {{ .Release.Name }} + name: {{ .Values.redisCluster.name | default .Release.Name }} labels: {{- include "common.labels" . | nindent 4 }} spec: clusterSize: {{ .Values.redisCluster.clusterSize }} @@ -13,14 +13,14 @@ spec: replicas: {{ .Values.redisCluster.leader.replicas }} {{- if .Values.externalConfig.enabled }} redisConfig: - additionalRedisConfig: "{{ .Release.Name }}-ext-config" + additionalRedisConfig: "{{ .Values.redisCluster.name | default .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" + additionalRedisConfig: "{{ .Values.redisCluster.name | default .Release.Name }}-ext-config" {{- end }} redisExporter: diff --git a/charts/redis-cluster/values.yaml b/charts/redis-cluster/values.yaml index b5ed2c56..4e77a20d 100644 --- a/charts/redis-cluster/values.yaml +++ b/charts/redis-cluster/values.yaml @@ -1,5 +1,6 @@ --- redisCluster: + name: "" clusterSize: 3 clusterVersion: v7 persistenceEnabled: true @@ -37,7 +38,7 @@ redisCluster: # effect: "NoSchedule" nodeSelector: null # memory: medium - securityContext : {} + securityContext: {} pdb: enabled: false maxUnavailable: 1 @@ -62,7 +63,7 @@ redisCluster: # effect: "NoSchedule" nodeSelector: null # memory: medium - securityContext : {} + securityContext: {} pdb: enabled: false maxUnavailable: 1 @@ -125,7 +126,7 @@ sidecars: # value: "my-env-var-value" initContainer: - enabled: false + enabled: false image: "" imagePullPolicy: "IfNotPresent" resources: {} @@ -172,12 +173,12 @@ TLS: secret: secretName: "" -acl : - secret : +acl: + secret: secretName: "" -env : [] +env: [] # - name: VAR_NAME # value: "value1" -serviceAccountName : "" \ No newline at end of file +serviceAccountName: "" diff --git a/charts/redis-replication/Chart.yaml b/charts/redis-replication/Chart.yaml index 9bd4ce09..b4edfebd 100644 --- a/charts/redis-replication/Chart.yaml +++ b/charts/redis-replication/Chart.yaml @@ -9,7 +9,7 @@ maintainers: - name: shubham-cmyk sources: - https://github.com/ot-container-kit/redis-operator -version: 0.15.9 +version: 0.15.10 appVersion: "0.15.1" home: https://github.com/ot-container-kit/redis-operator keywords: diff --git a/charts/redis-replication/templates/extra-config.yaml b/charts/redis-replication/templates/extra-config.yaml index e751f561..d143cdb2 100644 --- a/charts/redis-replication/templates/extra-config.yaml +++ b/charts/redis-replication/templates/extra-config.yaml @@ -3,12 +3,12 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-ext-config + name: {{ .Values.redisReplication.name | default .Release.Name }}-ext-config labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisReplication.name | default .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/instance: {{ .Values.redisReplication.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware data: diff --git a/charts/redis-replication/templates/redis-replication.yaml b/charts/redis-replication/templates/redis-replication.yaml index 4e65b553..0939c5ab 100644 --- a/charts/redis-replication/templates/redis-replication.yaml +++ b/charts/redis-replication/templates/redis-replication.yaml @@ -2,7 +2,7 @@ apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisReplication metadata: - name: {{ .Release.Name }} + name: {{ .Values.redisReplication.name | default .Release.Name }} labels: {{- include "common.labels" . | nindent 4 }} spec: clusterSize: {{ .Values.redisReplication.clusterSize }} @@ -37,7 +37,7 @@ spec: {{- if .Values.externalConfig.enabled }} redisConfig: - additionalRedisConfig: "{{ .Release.Name }}-ext-config" + additionalRedisConfig: "{{ .Values.redisReplication.name | default .Release.Name }}-ext-config" {{- end }} {{- if .Values.storageSpec }} storage: {{ toYaml .Values.storageSpec | nindent 4 }} diff --git a/charts/redis-replication/templates/replication-service.yaml b/charts/redis-replication/templates/replication-service.yaml index 71dc4419..f9a3a7e0 100644 --- a/charts/redis-replication/templates/replication-service.yaml +++ b/charts/redis-replication/templates/replication-service.yaml @@ -3,22 +3,22 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-external-service + name: {{ .Values.redisReplication.name | default .Release.Name }}-external-service {{- if .Values.externalService.annotations }} annotations: {{ toYaml .Values.externalService.annotations | indent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisReplication.name | default .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/instance: {{ .Values.redisReplication.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: type: {{ .Values.externalService.serviceType }} selector: - app: {{ .Release.Name }} + app: {{ .Values.redisReplication.name | default .Release.Name }} redis_setup_type: replication role: replication ports: diff --git a/charts/redis-replication/templates/servicemonitor.yaml b/charts/redis-replication/templates/servicemonitor.yaml index 465636c7..1eaef343 100644 --- a/charts/redis-replication/templates/servicemonitor.yaml +++ b/charts/redis-replication/templates/servicemonitor.yaml @@ -3,18 +3,18 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Release.Name }}-prometheus-monitoring + name: {{ .Values.redisReplication.name | default .Release.Name }}-prometheus-monitoring labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisReplication.name | default .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/instance: {{ .Values.redisReplication.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: selector: matchLabels: - app: {{ .Release.Name }} + app: {{ .Values.redisReplication.name | default .Release.Name }} redis_setup_type: replication role: replication endpoints: diff --git a/charts/redis-replication/values.yaml b/charts/redis-replication/values.yaml index 644ef8b9..b2afb5ca 100644 --- a/charts/redis-replication/values.yaml +++ b/charts/redis-replication/values.yaml @@ -1,5 +1,6 @@ --- redisReplication: + name: "" clusterSize: 3 image: quay.io/opstree/redis tag: v7.0.12 @@ -20,6 +21,9 @@ redisReplication: ignoreAnnotations: [] # - "redis.opstreelabs.in/ignore" +# Overwite name for resources +# name: "" + labels: {} # foo: bar # test: echo @@ -61,7 +65,7 @@ redisExporter: # value: "value1" initContainer: - enabled: false + enabled: false image: "" imagePullPolicy: "IfNotPresent" resources: {} @@ -109,7 +113,7 @@ podSecurityContext: runAsUser: 1000 fsGroup: 1000 -securityContext : {} +securityContext: {} affinity: {} # nodeAffinity: @@ -127,7 +131,7 @@ tolerations: [] # value: "value" # effect: "NoSchedule" -serviceAccountName : "" +serviceAccountName: "" TLS: ca: ca.key @@ -136,10 +140,10 @@ TLS: secret: secretName: "" -acl : - secret : +acl: + secret: secretName: "" -env : [] +env: [] # - name: VAR_NAME # value: "value1" diff --git a/charts/redis-sentinel/Chart.yaml b/charts/redis-sentinel/Chart.yaml index e290d519..2f5803d7 100644 --- a/charts/redis-sentinel/Chart.yaml +++ b/charts/redis-sentinel/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: redis-sentinel description: Provides easy redis setup definitions for Kubernetes services, and deployment. -version: 0.15.10 +version: 0.15.11 appVersion: "0.15.1" home: https://github.com/ot-container-kit/redis-operator sources: diff --git a/charts/redis-sentinel/templates/extra-config.yaml b/charts/redis-sentinel/templates/extra-config.yaml index cf2c1069..400fc3c5 100644 --- a/charts/redis-sentinel/templates/extra-config.yaml +++ b/charts/redis-sentinel/templates/extra-config.yaml @@ -3,12 +3,12 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-ext-config + name: {{ .Values.redisSentinel.name | default .Release.Name }}-ext-config labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisSentinel.name | default .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/instance: {{ .Values.redisSentinel.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware data: diff --git a/charts/redis-sentinel/templates/redis-sentinel.yaml b/charts/redis-sentinel/templates/redis-sentinel.yaml index 1fab60a9..d0e4951e 100644 --- a/charts/redis-sentinel/templates/redis-sentinel.yaml +++ b/charts/redis-sentinel/templates/redis-sentinel.yaml @@ -2,7 +2,7 @@ apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisSentinel metadata: - name: {{ .Release.Name }} + name: {{ .Values.redisSentinel.name | default .Release.Name }} labels: {{- include "common.labels" . | nindent 4 }} spec: clusterSize: {{ .Values.redisSentinel.clusterSize }} @@ -16,7 +16,7 @@ spec: failoverTimeout: {{ .Values.redisSentinelConfig.failoverTimeout | default "180000" | quote}} downAfterMilliseconds: {{ .Values.redisSentinelConfig.downAfterMilliseconds | default "30000" | quote}} {{- if eq .Values.externalConfig.enabled true }} - additionalSentinelConfig: {{ .Release.Name }}-ext-config + additionalSentinelConfig: {{ .Values.redisSentinel.name | default .Release.Name }}-ext-config {{- end }} kubernetesConfig: @@ -50,7 +50,7 @@ spec: {{- if .Values.externalConfig.enabled }} redisConfig: - additionalRedisConfig: "{{ .Release.Name }}-ext-config" + additionalRedisConfig: "{{ .Values.redisSentinel.name | default .Release.Name }}-ext-config" {{- end }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | nindent 4 }} diff --git a/charts/redis-sentinel/templates/service.yaml b/charts/redis-sentinel/templates/service.yaml index 5c3d3c19..112da8b0 100644 --- a/charts/redis-sentinel/templates/service.yaml +++ b/charts/redis-sentinel/templates/service.yaml @@ -3,22 +3,22 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-external-service + name: {{ .Values.redisSentinel.name | default .Release.Name }}-external-service {{- if .Values.externalService.annotations }} annotations: {{ toYaml .Values.externalService.annotations | indent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisSentinel.name | default .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/instance: {{ .Values.redisSentinel.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: type: {{ .Values.externalService.serviceType }} selector: - app: {{ .Release.Name }} + app: {{ .Values.redisSentinel.name | default .Release.Name }} redis_setup_type: sentinel role: sentinel ports: diff --git a/charts/redis-sentinel/values.yaml b/charts/redis-sentinel/values.yaml index 51757eba..43d8c86a 100644 --- a/charts/redis-sentinel/values.yaml +++ b/charts/redis-sentinel/values.yaml @@ -1,5 +1,6 @@ --- redisSentinel: + name: "" clusterSize: 3 image: quay.io/opstree/redis-sentinel tag: v7.0.12 @@ -20,6 +21,9 @@ redisSentinel: ignoreAnnotations: [] # - "redis.opstreelabs.in/ignore" +# Overwite name for resources +# name: "" + labels: {} # foo: bar # test: echo diff --git a/charts/redis/Chart.yaml b/charts/redis/Chart.yaml index 1eb4a455..95148d13 100644 --- a/charts/redis/Chart.yaml +++ b/charts/redis/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: redis description: Provides easy redis setup definitions for Kubernetes services, and deployment. -version: 0.15.9 +version: 0.15.10 appVersion: "0.15.1" home: https://github.com/ot-container-kit/redis-operator sources: diff --git a/charts/redis/README.md b/charts/redis/README.md index 45485e8f..a506943c 100644 --- a/charts/redis/README.md +++ b/charts/redis/README.md @@ -37,6 +37,7 @@ helm delete --namespace | `redisStandalone.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | | `redisStandalone.serviceType` | ClusterIP | Kubernetes service type for Redis | | `redisStandalone.resources` | {} | Request and limits for redis statefulset | +| `redisStandalone.name` | "" | Overwrites the name for the charts resources instead of the Release name | | `externalService.enabled` | false | If redis service needs to be exposed using LoadBalancer or NodePort | | `externalService.annotations` | {} | Kubernetes service related annotations | | `externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | diff --git a/charts/redis/templates/_helpers.tpl b/charts/redis/templates/_helpers.tpl index cfc58681..698c901e 100644 --- a/charts/redis/templates/_helpers.tpl +++ b/charts/redis/templates/_helpers.tpl @@ -2,10 +2,10 @@ {{/* Define common labels */}} {{- define "common.labels" -}} -app.kubernetes.io/name: {{ .Release.Name }} +app.kubernetes.io/name: {{ .Values.redisStandalone.name | default .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/instance: {{ .Values.redisStandalone.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware {{- if .Values.labels }} diff --git a/charts/redis/templates/extra-config.yaml b/charts/redis/templates/extra-config.yaml index e751f561..d1eb804d 100644 --- a/charts/redis/templates/extra-config.yaml +++ b/charts/redis/templates/extra-config.yaml @@ -3,12 +3,12 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-ext-config + name: {{ .Values.redisStandalone.name | default .Release.Name }}-ext-config labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisStandalone.name | default .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/instance: {{ .Values.redisStandalone.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware data: diff --git a/charts/redis/templates/redis-standalone.yaml b/charts/redis/templates/redis-standalone.yaml index c69fa5c3..d1e932e6 100644 --- a/charts/redis/templates/redis-standalone.yaml +++ b/charts/redis/templates/redis-standalone.yaml @@ -2,7 +2,7 @@ apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: - name: {{ .Release.Name }} + name: {{ .Values.redisStandalone.name | default .Release.Name }} labels: {{- include "common.labels" . | nindent 4 }} spec: kubernetesConfig: @@ -36,7 +36,7 @@ spec: {{- if .Values.externalConfig.enabled }} redisConfig: - additionalRedisConfig: "{{ .Release.Name }}-ext-config" + additionalRedisConfig: "{{ .Values.redisStandalone.name | default .Release.Name }}-ext-config" {{- end }} {{- if .Values.storageSpec }} storage: {{ toYaml .Values.storageSpec | nindent 4 }} diff --git a/charts/redis/templates/service.yaml b/charts/redis/templates/service.yaml index 46b2310a..32e98cb8 100644 --- a/charts/redis/templates/service.yaml +++ b/charts/redis/templates/service.yaml @@ -3,22 +3,22 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-external-service + name: {{ .Values.redisStandalone.name | default .Release.Name }}-external-service {{- if .Values.externalService.annotations }} annotations: {{ toYaml .Values.externalService.annotations | indent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisStandalone.name | default .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/instance: {{ .Values.redisStandalone.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: type: {{ .Values.externalService.serviceType }} selector: - app: {{ .Release.Name }} + app: {{ .Values.redisStandalone.name | default .Release.Name }} redis_setup_type: standalone role: standalone ports: diff --git a/charts/redis/templates/servicemonitor.yaml b/charts/redis/templates/servicemonitor.yaml index 1e5a6b01..883f16b5 100644 --- a/charts/redis/templates/servicemonitor.yaml +++ b/charts/redis/templates/servicemonitor.yaml @@ -3,18 +3,18 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Release.Name }}-prometheus-monitoring + name: {{ .Values.redisStandalone.name | default .Release.Name }}-prometheus-monitoring labels: - app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Values.redisStandalone.name | default .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/instance: {{ .Values.redisStandalone.name | default .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion }} app.kubernetes.io/component: middleware spec: selector: matchLabels: - app: {{ .Release.Name }} + app: {{ .Values.redisStandalone.name | default .Release.Name }} redis_setup_type: standalone role: standalone endpoints: diff --git a/charts/redis/values.yaml b/charts/redis/values.yaml index 17ce72e9..e929a2eb 100644 --- a/charts/redis/values.yaml +++ b/charts/redis/values.yaml @@ -1,5 +1,6 @@ --- redisStandalone: + name: "" image: quay.io/opstree/redis tag: v7.0.12 imagePullPolicy: IfNotPresent @@ -60,7 +61,7 @@ redisExporter: # value: "value1" initContainer: - enabled: false + enabled: false image: "" imagePullPolicy: "IfNotPresent" resources: {} @@ -108,7 +109,7 @@ podSecurityContext: runAsUser: 1000 fsGroup: 1000 -securityContext : {} +securityContext: {} affinity: {} # nodeAffinity: @@ -126,7 +127,7 @@ tolerations: [] # value: "value" # effect: "NoSchedule" -serviceAccountName : "" +serviceAccountName: "" TLS: ca: ca.key @@ -135,10 +136,10 @@ TLS: secret: secretName: "" -acl : - secret : +acl: + secret: secretName: "" -env : [] +env: [] # - name: VAR_NAME - # value: "value1" \ No newline at end of file + # value: "value1"