Skip to content

Commit

Permalink
feat: Make securityContext configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
itboon committed Sep 16, 2024
1 parent a5c2b7d commit a8aa2d5
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 5 deletions.
11 changes: 9 additions & 2 deletions charts/rocketmq-cluster/templates/broker/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,19 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
fsGroup: 3000
runAsUser: 3000
{{- if $.Values.broker.podSecurityContext }}
{{- toYaml $.Values.broker.podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: broker
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with $.Values.broker.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq-cluster/templates/controller/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: nameserver
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq-cluster/templates/nameserver/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: nameserver
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq-cluster/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: proxy
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
7 changes: 7 additions & 0 deletions charts/rocketmq-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ image:
pullPolicy: IfNotPresent
tag: "5.3.0"

podSecurityContext:
fsGroup: 3000
runAsUser: 3000

broker:
size:
master: 2
replica: 1

# podSecurityContext: {}
# containerSecurityContext: {}

master:
brokerRole: ASYNC_MASTER
jvm:
Expand Down
11 changes: 9 additions & 2 deletions charts/rocketmq/templates/broker/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,19 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
fsGroup: 3000
runAsUser: 3000
{{- if $.Values.broker.podSecurityContext }}
{{- toYaml $.Values.broker.podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: broker
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with $.Values.broker.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq/templates/controller/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: nameserver
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq/templates/nameserver/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: nameserver
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
10 changes: 10 additions & 0 deletions charts/rocketmq/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- if .podSecurityContext }}
{{- toYaml .podSecurityContext | nindent 8 }}
{{- else if $.Values.podSecurityContext }}
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: proxy
image: {{ $image | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
{{- with .containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
command:
- sh
- /mq-server-start.sh
Expand Down
9 changes: 8 additions & 1 deletion charts/rocketmq/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ image:
pullPolicy: IfNotPresent
tag: "5.3.0"

podSecurityContext:
fsGroup: 3000
runAsUser: 3000

broker:
size:
master: 1
replica: 0

# podSecurityContext: {}
# containerSecurityContext: {}

master:
brokerRole: ASYNC_MASTER
jvm:
Expand Down Expand Up @@ -89,7 +96,7 @@ nameserver:

persistence:
enabled: false
size: 8Gi
size: 20Gi
#storageClass: "gp2"

affinityOverride: {}
Expand Down

0 comments on commit a8aa2d5

Please sign in to comment.