Skip to content

Commit 98db876

Browse files
authoredDec 11, 2023
bitnami/redis Add namespaceOverride capability to redis chart (#21479)
* Add namespaceOverride capability to redis chart Signed-off-by: Juan Gonzalez <jgfm@novonordisk.com> * Replace blank char with space Signed-off-by: Juan Gonzalez <jgfm@novonordisk.com> --------- Signed-off-by: Juan Gonzalez <jgfm@novonordisk.com>
1 parent d2a41e2 commit 98db876

35 files changed

+81
-77
lines changed
 

‎bitnami/redis/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ maintainers:
3434
name: redis
3535
sources:
3636
- https://github.com/bitnami/charts/tree/main/bitnami/redis
37-
version: 18.4.0
37+
version: 18.5.0

‎bitnami/redis/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The command removes all the Kubernetes components associated with the chart and
8585
| `kubeVersion` | Override Kubernetes version | `""` |
8686
| `nameOverride` | String to partially override common.names.fullname | `""` |
8787
| `fullnameOverride` | String to fully override common.names.fullname | `""` |
88+
| `namespaceOverride` | String to fully override common.names.namespace | `""` |
8889
| `commonLabels` | Labels to add to all deployed objects | `{}` |
8990
| `commonAnnotations` | Annotations to add to all deployed objects | `{}` |
9091
| `secretAnnotations` | Annotations to add to secret | `{}` |

‎bitnami/redis/templates/NOTES.txt

+22-22
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ The chart has been deployed in diagnostic mode. All probes have been disabled an
1212

1313
Get the list of pods by executing:
1414

15-
kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }}
15+
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}
1616

1717
Access the pod you want to debug by executing
1818

19-
kubectl exec --namespace {{ .Release.Namespace }} -ti <NAME OF THE POD> -- bash
19+
kubectl exec --namespace {{ include "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash
2020

2121
In order to replicate the container startup scripts execute this command:
2222

@@ -58,55 +58,55 @@ For Redis Sentinel:
5858

5959
Redis&reg; can be accessed via port {{ .Values.sentinel.service.ports.redis }} on the following DNS name from within your cluster:
6060

61-
{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read only operations
61+
{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }} for read only operations
6262

6363
For read/write operations, first access the Redis&reg; Sentinel cluster, which is available in port {{ .Values.sentinel.service.ports.sentinel }} using the same domain name above.
6464

6565
{{- else }}
6666

6767
Redis&reg; can be accessed on the following DNS names from within your cluster:
6868

69-
{{ printf "%s-master.%s.svc.%s" (include "common.names.fullname" .) .Release.Namespace .Values.clusterDomain }} for read/write operations (port {{ .Values.master.service.ports.redis }})
70-
{{ printf "%s-replicas.%s.svc.%s" (include "common.names.fullname" .) .Release.Namespace .Values.clusterDomain }} for read-only operations (port {{ .Values.replica.service.ports.redis }})
69+
{{ printf "%s-master.%s.svc.%s" (include "common.names.fullname" .) (include "common.names.namespace" . ) .Values.clusterDomain }} for read/write operations (port {{ .Values.master.service.ports.redis }})
70+
{{ printf "%s-replicas.%s.svc.%s" (include "common.names.fullname" .) (include "common.names.namespace" . ) .Values.clusterDomain }} for read-only operations (port {{ .Values.replica.service.ports.redis }})
7171

7272
{{- end }}
7373
{{- else }}
7474

7575
Redis&reg; can be accessed via port {{ .Values.master.service.ports.redis }} on the following DNS name from within your cluster:
7676

77-
{{ template "common.names.fullname" . }}-master.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
77+
{{ template "common.names.fullname" . }}-master.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
7878

7979
{{- end }}
8080

8181
{{ if .Values.auth.enabled }}
8282

8383
To get your password run:
8484

85-
export REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "redis.secretName" . }} -o jsonpath="{.data.redis-password}" | base64 -d)
85+
export REDIS_PASSWORD=$(kubectl get secret --namespace {{ include "common.names.namespace" . }} {{ template "redis.secretName" . }} -o jsonpath="{.data.redis-password}" | base64 -d)
8686

8787
{{- end }}
8888

8989
To connect to your Redis&reg; server:
9090

9191
1. Run a Redis&reg; pod that you can use as a client:
9292

93-
kubectl run --namespace {{ .Release.Namespace }} redis-client --restart='Never' {{ if .Values.auth.enabled }} --env REDIS_PASSWORD=$REDIS_PASSWORD {{ end }} --image {{ template "redis.image" . }} --command -- sleep infinity
93+
kubectl run --namespace {{ include "common.names.namespace" . }} redis-client --restart='Never' {{ if .Values.auth.enabled }} --env REDIS_PASSWORD=$REDIS_PASSWORD {{ end }} --image {{ template "redis.image" . }} --command -- sleep infinity
9494

9595
{{- if .Values.tls.enabled }}
9696

9797
Copy your TLS certificates to the pod:
9898

99-
kubectl cp --namespace {{ .Release.Namespace }} /path/to/client.cert redis-client:/tmp/client.cert
100-
kubectl cp --namespace {{ .Release.Namespace }} /path/to/client.key redis-client:/tmp/client.key
101-
kubectl cp --namespace {{ .Release.Namespace }} /path/to/CA.cert redis-client:/tmp/CA.cert
99+
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/client.cert redis-client:/tmp/client.cert
100+
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/client.key redis-client:/tmp/client.key
101+
kubectl cp --namespace {{ include "common.names.namespace" . }} /path/to/CA.cert redis-client:/tmp/CA.cert
102102

103103
{{- end }}
104104

105105
Use the following command to attach to the pod:
106106

107107
kubectl exec --tty -i redis-client \
108108
{{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "common.names.fullname" . }}-client=true" \{{- end }}
109-
--namespace {{ .Release.Namespace }} -- bash
109+
--namespace {{ include "common.names.namespace" . }} -- bash
110110

111111
2. Connect using the Redis&reg; CLI:
112112

@@ -133,42 +133,42 @@ To connect to your database from outside the cluster execute the following comma
133133
{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled }}
134134
{{- if contains "NodePort" .Values.sentinel.service.type }}
135135

136-
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
137-
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
136+
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
137+
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
138138
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
139139

140140
{{- else if contains "LoadBalancer" .Values.sentinel.service.type }}
141141

142142
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
143-
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "common.names.fullname" . }}'
143+
Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'
144144

145-
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
145+
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
146146
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h $SERVICE_IP -p {{ .Values.sentinel.service.ports.redis }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
147147

148148
{{- else if contains "ClusterIP" .Values.sentinel.service.type }}
149149

150-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "common.names.fullname" . }} {{ .Values.sentinel.service.ports.redis }}:{{ .Values.sentinel.service.ports.redis }} &
150+
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} {{ .Values.sentinel.service.ports.redis }}:{{ .Values.sentinel.service.ports.redis }} &
151151
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h 127.0.0.1 -p {{ .Values.sentinel.service.ports.redis }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
152152

153153
{{- end }}
154154
{{- else }}
155155
{{- if contains "NodePort" .Values.master.service.type }}
156156

157-
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
158-
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ printf "%s-master" (include "common.names.fullname" .) }})
157+
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
158+
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ printf "%s-master" (include "common.names.fullname" .) }})
159159
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
160160

161161
{{- else if contains "LoadBalancer" .Values.master.service.type }}
162162

163163
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
164-
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "common.names.fullname" . }}'
164+
Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'
165165

166-
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ printf "%s-master" (include "common.names.fullname" .) }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
166+
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ printf "%s-master" (include "common.names.fullname" .) }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
167167
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h $SERVICE_IP -p {{ .Values.master.service.ports.redis }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
168168

169169
{{- else if contains "ClusterIP" .Values.master.service.type }}
170170

171-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ printf "%s-master" (include "common.names.fullname" .) }} {{ .Values.master.service.ports.redis }}:{{ .Values.master.service.ports.redis }} &
171+
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ printf "%s-master" (include "common.names.fullname" .) }} {{ .Values.master.service.ports.redis }}:{{ .Values.master.service.ports.redis }} &
172172
{{ if .Values.auth.enabled }}REDISCLI_AUTH="$REDIS_PASSWORD" {{ end }}redis-cli -h 127.0.0.1 -p {{ .Values.master.service.ports.redis }} {{- if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
173173

174174
{{- end }}

‎bitnami/redis/templates/_helpers.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Return Redis&reg; password
240240
{{- else if not (empty .Values.auth.password) -}}
241241
{{- .Values.auth.password -}}
242242
{{- else -}}
243-
{{- include "getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "redis.secretName" .) "Length" 10 "Key" (include "redis.secretPasswordKey" .)) -}}
243+
{{- include "getValueFromSecret" (dict "Namespace" (include "common.names.namespace" .) "Name" (include "redis.secretName" .) "Length" 10 "Key" (include "redis.secretPasswordKey" .)) -}}
244244
{{- end -}}
245245
{{- end -}}
246246
{{- end }}

‎bitnami/redis/templates/configmap.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apiVersion: v1
88
kind: ConfigMap
99
metadata:
1010
name: {{ printf "%s-configuration" (include "common.names.fullname" .) }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
{{- if .Values.commonAnnotations }}
1414
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
@@ -48,7 +48,7 @@ data:
4848
sentinel.conf: |-
4949
dir "/tmp"
5050
port {{ .Values.sentinel.containerPorts.sentinel }}
51-
sentinel monitor {{ .Values.sentinel.masterSet }} {{ template "common.names.fullname" . }}-node-0.{{ template "common.names.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} {{ .Values.sentinel.service.ports.redis }} {{ .Values.sentinel.quorum }}
51+
sentinel monitor {{ .Values.sentinel.masterSet }} {{ template "common.names.fullname" . }}-node-0.{{ template "common.names.fullname" . }}-headless.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }} {{ .Values.sentinel.service.ports.redis }} {{ .Values.sentinel.quorum }}
5252
sentinel down-after-milliseconds {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.downAfterMilliseconds }}
5353
sentinel failover-timeout {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.failoverTimeout }}
5454
sentinel parallel-syncs {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.parallelSyncs }}

‎bitnami/redis/templates/headless-svc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apiVersion: v1
77
kind: Service
88
metadata:
99
name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
10-
namespace: {{ .Release.Namespace | quote }}
10+
namespace: {{ include "common.names.namespace" . | quote }}
1111
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1212
annotations:
1313
{{- if or .Values.sentinel.service.headless.annotations .Values.commonAnnotations }}

‎bitnami/redis/templates/health-configmap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apiVersion: v1
77
kind: ConfigMap
88
metadata:
99
name: {{ printf "%s-health" (include "common.names.fullname" .) }}
10-
namespace: {{ .Release.Namespace | quote }}
10+
namespace: {{ include "common.names.namespace" . | quote }}
1111
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1212
{{- if .Values.commonAnnotations }}
1313
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}

‎bitnami/redis/templates/master/application.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
99
kind: {{ .Values.master.kind }}
1010
metadata:
1111
name: {{ printf "%s-master" (include "common.names.fullname" .) }}
12-
namespace: {{ .Release.Namespace | quote }}
12+
namespace: {{ include "common.names.namespace" . | quote }}
1313
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1414
app.kubernetes.io/component: master
1515
{{- if .Values.commonAnnotations }}

‎bitnami/redis/templates/master/psp.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apiVersion: policy/v1beta1
88
kind: PodSecurityPolicy
99
metadata:
1010
name: {{ printf "%s-master" (include "common.names.fullname" .) }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
{{- if .Values.commonAnnotations }}
1414
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}

‎bitnami/redis/templates/master/pvc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ kind: PersistentVolumeClaim
88
apiVersion: v1
99
metadata:
1010
name: {{ printf "redis-data-%s-master" (include "common.names.fullname" .) }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.master.persistence.labels .Values.commonLabels ) "context" . ) }}
1313
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
1414
app.kubernetes.io/component: master

‎bitnami/redis/templates/master/service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apiVersion: v1
88
kind: Service
99
metadata:
1010
name: {{ printf "%s-master" (include "common.names.fullname" .) }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
app.kubernetes.io/component: master
1414
{{- if or .Values.master.service.annotations .Values.commonAnnotations }}

‎bitnami/redis/templates/master/serviceaccount.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ kind: ServiceAccount
99
automountServiceAccountToken: {{ .Values.master.serviceAccount.automountServiceAccountToken }}
1010
metadata:
1111
name: {{ template "redis.masterServiceAccountName" . }}
12-
namespace: {{ .Release.Namespace | quote }}
12+
namespace: {{ include "common.names.namespace" . | quote }}
1313
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1414
{{- if or .Values.master.serviceAccount.annotations .Values.commonAnnotations }}
1515
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.master.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}

‎bitnami/redis/templates/metrics-svc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apiVersion: v1
88
kind: Service
99
metadata:
1010
name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
app.kubernetes.io/component: metrics
1414
{{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}

‎bitnami/redis/templates/networkpolicy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ kind: NetworkPolicy
88
apiVersion: {{ template "networkPolicy.apiVersion" . }}
99
metadata:
1010
name: {{ template "common.names.fullname" . }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
{{- if .Values.commonAnnotations }}
1414
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}

‎bitnami/redis/templates/pdb.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
88
kind: PodDisruptionBudget
99
metadata:
1010
name: {{ template "common.names.fullname" . }}
11-
namespace: {{ .Release.Namespace | quote }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
1212
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1313
{{- if .Values.commonAnnotations }}
1414
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}

0 commit comments

Comments
 (0)
Please sign in to comment.