Skip to content

Commit

Permalink
feat: add securityContext config in chart for redis-exporter (#1238)
Browse files Browse the repository at this point in the history
feat: add securityContext config for redis-exporter

Add ability to configure securityContext for redis-exporter in redis helm charts:
- redis
- redis-cluster
- redis-replication
- redis-sentinel

Supported in:
- v1beta1 & v1beta2: Redis, RedisCluster, RedisReplication Operator CRDs
- v1beta2 only: RedisSentinel Operator CRD

This aligns with existing redis operator CRD functionality.

Signed-off-by: Hexoplon <github@zackeus.no>
  • Loading branch information
Hexoplon authored Feb 11, 2025
1 parent f7e9204 commit 9dbec50
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ helm delete <my-release> --namespace <namespace>
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.securityContext | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| serviceAccountName | string | `""` | |
| serviceMonitor.enabled | bool | `false` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-cluster/templates/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ spec:
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.securityContext}}
securityContext: {{ toYaml .Values.redisExporter.securityContext | nindent 6 }}
{{- end }}

kubernetesConfig:
image: "{{ .Values.redisCluster.image }}:{{ .Values.redisCluster.tag }}"
Expand Down
1 change: 1 addition & 0 deletions charts/redis-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ redisExporter:
env: []
# - name: VAR_NAME
# value: "value1"
securityContext: {}

sidecars:
name: ""
Expand Down
1 change: 1 addition & 0 deletions charts/redis-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ helm delete <my-release> --namespace <namespace>
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.securityContext | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| redisReplication.clusterSize | int | `3` | |
| redisReplication.ignoreAnnotations | list | `[]` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-replication/templates/redis-replication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ spec:
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.securityContext}}
securityContext: {{ toYaml .Values.redisExporter.securityContext | nindent 6 }}
{{- end }}

{{- if .Values.externalConfig.enabled }}
redisConfig:
Expand Down
1 change: 1 addition & 0 deletions charts/redis-replication/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ redisExporter:
env: []
# - name: VAR_NAME
# value: "value1"
securityContext: {}

initContainer:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions charts/redis-sentinel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ helm delete <my-release> --namespace <namespace>
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.securityContext | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| redisSentinel.clusterSize | int | `3` | |
| redisSentinel.ignoreAnnotations | list | `[]` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis-sentinel/templates/redis-sentinel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.securityContext}}
securityContext: {{ toYaml .Values.redisExporter.securityContext | nindent 6 }}
{{- end }}

{{- if .Values.nodeSelector }}
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/redis-sentinel/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ redisExporter:
env: []
# - name: VAR_NAME
# value: "value1"
securityContext: {}

initContainer:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions charts/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ helm delete <my-release> --namespace <namespace>
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.securityContext | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| redisStandalone.ignoreAnnotations | list | `[]` | |
| redisStandalone.image | string | `"quay.io/opstree/redis"` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/redis/templates/redis-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.securityContext}}
securityContext: {{ toYaml .Values.redisExporter.securityContext | nindent 6 }}
{{- end }}

{{- if .Values.externalConfig.enabled }}
redisConfig:
Expand Down
1 change: 1 addition & 0 deletions charts/redis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ redisExporter:
env: []
# - name: VAR_NAME
# value: "value1"
securityContext: {}

initContainer:
enabled: false
Expand Down

0 comments on commit 9dbec50

Please sign in to comment.