@@ -28,27 +28,21 @@ spec:
28
28
{{ . | nindent 6 }}
29
29
{{- end }}
30
30
serviceAccountName : {{ include "rabbitmq.serviceAccountName" . }}
31
- {{- if .Values.podSecurityContext }}
32
- securityContext :
33
- {{- toYaml .Values.podSecurityContext | nindent 8 }}
34
- {{- end }}
31
+ securityContext : {{ include "common.renderPodSecurityContext" . | nindent 8 }}
35
32
{{- if or .Values.auth.enabled .Values.installPlugins .Values.customScripts.initContainers }}
36
33
initContainers :
37
34
{{- if .Values.auth.enabled }}
38
35
- name : init-erlang-cookie
39
36
image : " {{ .Values.initContainer.image.registry | default .Values.global.imageRegistry }}/{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
40
37
imagePullPolicy : " {{ .Values.initContainer.image.pullPolicy }}"
41
- {{- if .Values.initContainer.securityContext }}
42
- securityContext :
43
- {{- toYaml .Values.initContainer.securityContext | nindent 12 }}
44
- {{- end }}
38
+ securityContext : {{ include "common.renderContainerSecurityContext" . | nindent 12 }}
45
39
command :
46
40
- sh
47
41
- -c
48
42
- |
49
43
echo "$RABBITMQ_ERLANG_COOKIE" > /var/lib/rabbitmq/.erlang.cookie
50
44
chmod 400 /var/lib/rabbitmq/.erlang.cookie
51
- chown {{ .Values.securityContext.runAsUser | default 999 }}:{{ .Values.securityContext.runAsGroup | default 999 }} /var/lib/rabbitmq/.erlang.cookie
45
+ chown $(id -u):$(id -g) /var/lib/rabbitmq/.erlang.cookie
52
46
env :
53
47
- name : RABBITMQ_ERLANG_COOKIE
54
48
valueFrom :
63
57
- name : download-plugins
64
58
image : " {{ .Values.initContainer.image.registry | default .Values.global.imageRegistry }}/{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
65
59
imagePullPolicy : " {{ .Values.initContainer.image.pullPolicy }}"
66
- {{- if .Values.initContainer.securityContext }}
67
- securityContext :
68
- {{- toYaml .Values.initContainer.securityContext | nindent 12 }}
69
- {{- end }}
60
+ securityContext : {{ include "common.renderContainerSecurityContext" . | nindent 12 }}
70
61
command :
71
62
- sh
72
63
- -c
91
82
- name : copy-plugins
92
83
image : {{ include "rabbitmq.image" . | quote }}
93
84
imagePullPolicy : {{ include "common.imagePullPolicy" (dict "image" .Values.image) }}
94
- {{- if .Values.initContainer.securityContext }}
95
- securityContext :
96
- {{- toYaml .Values.initContainer.securityContext | nindent 12 }}
97
- {{- end }}
85
+ securityContext : {{ include "common.renderContainerSecurityContext" . | nindent 12 }}
98
86
command :
99
87
- sh
100
88
- -c
@@ -112,10 +100,7 @@ spec:
112
100
{{- end }}
113
101
containers :
114
102
- name : {{ .Chart.Name }}
115
- {{- if .Values.securityContext }}
116
- securityContext :
117
- {{- toYaml .Values.securityContext | nindent 12 }}
118
- {{- end }}
103
+ securityContext : {{ include "common.renderContainerSecurityContext" . | nindent 12 }}
119
104
image : {{ include "rabbitmq.image" . | quote }}
120
105
imagePullPolicy : {{ include "common.imagePullPolicy" (dict "image" .Values.image) }}
121
106
{{- if .Values.customScripts.postStart.enabled }}
0 commit comments