Skip to content

Commit

Permalink
[rabbitmq] fix permissions if persistence is enabled
Browse files Browse the repository at this point in the history
`fsGroupChangePolicy: "OnRootMismatch"`does not work for NFS mounts
(also see kubernetes/examples/issues/260)
  • Loading branch information
Carthaca committed Mar 8, 2024
1 parent 85c9ba2 commit 35ffd6d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/rabbitmq/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: rabbitmq
version: 0.6.5
version: 0.6.6
description: A Helm chart for RabbitMQ
sources:
- https://github.com/sapcc/helm-charts/common/rabbitmq
12 changes: 12 additions & 0 deletions common/rabbitmq/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ spec:
runAsGroup: 999
fsGroup: 999
fsGroupChangePolicy: "OnRootMismatch"
{{- if .Values.persistence.enabled }}
initContainers:
- name: volume-permissions
image: "{{include "dockerHubMirror" .}}/library/busybox"
imagePullPolicy: {{ default "IfNotPresent" .Values.imagePullPolicy | quote }}
command: ["/bin/chown", "-R", "999:999", "/var/lib/rabbitmq"]
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /var/lib/rabbitmq
name: rabbitmq-persistent-storage
{{- end }}
containers:
- name: rabbitmq
image: "{{include "dockerHubMirror" .}}/{{ .Values.image }}:{{.Values.imageTag }}"
Expand Down
12 changes: 12 additions & 0 deletions common/rabbitmq/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ spec:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
{{- if .Values.persistence.enabled }}
initContainers:
- name: volume-permissions
image: "{{include "dockerHubMirror" .}}/library/busybox"
imagePullPolicy: {{ default "IfNotPresent" .Values.imagePullPolicy | quote }}
command: ["/bin/chown", "-R", "999:999", "/var/lib/rabbitmq"]
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /var/lib/rabbitmq
name: rabbitmq-persistent-storage
{{- end }}
containers:
- name: rabbitmq
image: "{{include "dockerHubMirror" .}}/{{ .Values.image }}:{{.Values.imageTag }}"
Expand Down

0 comments on commit 35ffd6d

Please sign in to comment.