Skip to content

Commit b6ab75e

Browse files
authored
Add optin for securitycontext in helm (#2758)
* add option for securitycontext * set default to true * moved securitycontext before services
1 parent e422343 commit b6ab75e

11 files changed

+25
-0
lines changed

helm-chart/templates/adservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ spec:
4949
serviceAccountName: default
5050
{{- end }}
5151
terminationGracePeriodSeconds: 5
52+
{{- if .Values.securityContext.enable }}
5253
securityContext:
5354
fsGroup: 1000
5455
runAsGroup: 1000
5556
runAsNonRoot: true
5657
runAsUser: 1000
58+
{{- end }}
5759
{{- if .Values.seccompProfile.enable }}
5860
seccompProfile:
5961
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/cartservice.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ spec:
5353
serviceAccountName: default
5454
{{- end }}
5555
terminationGracePeriodSeconds: 5
56+
{{- if .Values.securityContext.enable }}
5657
securityContext:
5758
fsGroup: 1000
5859
runAsGroup: 1000
5960
runAsNonRoot: true
6061
runAsUser: 1000
62+
{{- end }}
6163
{{- if .Values.seccompProfile.enable }}
6264
seccompProfile:
6365
type: {{ .Values.seccompProfile.type }}
@@ -229,11 +231,13 @@ spec:
229231
{{- else }}
230232
serviceAccountName: default
231233
{{- end }}
234+
{{- if .Values.securityContext.enable }}
232235
securityContext:
233236
fsGroup: 1000
234237
runAsGroup: 1000
235238
runAsNonRoot: true
236239
runAsUser: 1000
240+
{{- end }}
237241
{{- if .Values.seccompProfile.enable }}
238242
seccompProfile:
239243
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/checkoutservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ spec:
4848
{{- else }}
4949
serviceAccountName: default
5050
{{- end }}
51+
{{- if .Values.securityContext.enable }}
5152
securityContext:
5253
fsGroup: 1000
5354
runAsGroup: 1000
5455
runAsNonRoot: true
5556
runAsUser: 1000
57+
{{- end }}
5658
{{- if .Values.seccompProfile.enable }}
5759
seccompProfile:
5860
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/currencyservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ spec:
4949
serviceAccountName: default
5050
{{- end }}
5151
terminationGracePeriodSeconds: 5
52+
{{- if .Values.securityContext.enable }}
5253
securityContext:
5354
fsGroup: 1000
5455
runAsGroup: 1000
5556
runAsNonRoot: true
5657
runAsUser: 1000
58+
{{- end }}
5759
{{- if .Values.seccompProfile.enable }}
5860
seccompProfile:
5961
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/emailservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ spec:
4949
serviceAccountName: default
5050
{{- end }}
5151
terminationGracePeriodSeconds: 5
52+
{{- if .Values.securityContext.enable }}
5253
securityContext:
5354
fsGroup: 1000
5455
runAsGroup: 1000
5556
runAsNonRoot: true
5657
runAsUser: 1000
58+
{{- end }}
5759
{{- if .Values.seccompProfile.enable }}
5860
seccompProfile:
5961
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/frontend.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ spec:
5050
{{- else }}
5151
serviceAccountName: default
5252
{{- end }}
53+
{{- if .Values.securityContext.enable }}
5354
securityContext:
5455
fsGroup: 1000
5556
runAsGroup: 1000
5657
runAsNonRoot: true
5758
runAsUser: 1000
59+
{{- end }}
5860
{{- if .Values.seccompProfile.enable }}
5961
seccompProfile:
6062
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/loadgenerator.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ spec:
5353
{{- end }}
5454
terminationGracePeriodSeconds: 5
5555
restartPolicy: Always
56+
{{- if .Values.securityContext.enable }}
5657
securityContext:
5758
fsGroup: 1000
5859
runAsGroup: 1000
5960
runAsNonRoot: true
6061
runAsUser: 1000
62+
{{- end }}
6163
{{- if .Values.seccompProfile.enable }}
6264
seccompProfile:
6365
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/productcatalogservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ spec:
4949
serviceAccountName: default
5050
{{- end }}
5151
terminationGracePeriodSeconds: 5
52+
{{- if .Values.securityContext.enable }}
5253
securityContext:
5354
fsGroup: 1000
5455
runAsGroup: 1000
5556
runAsNonRoot: true
5657
runAsUser: 1000
58+
{{- end }}
5759
{{- if .Values.seccompProfile.enable }}
5860
seccompProfile:
5961
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/recommendationservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ spec:
4949
serviceAccountName: default
5050
{{- end }}
5151
terminationGracePeriodSeconds: 5
52+
{{- if .Values.securityContext.enable }}
5253
securityContext:
5354
fsGroup: 1000
5455
runAsGroup: 1000
5556
runAsNonRoot: true
5657
runAsUser: 1000
58+
{{- end }}
5759
{{- if .Values.seccompProfile.enable }}
5860
seccompProfile:
5961
type: {{ .Values.seccompProfile.type }}

helm-chart/templates/shippingservice.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ spec:
4848
{{- else }}
4949
serviceAccountName: default
5050
{{- end }}
51+
{{- if .Values.securityContext.enable }}
5152
securityContext:
5253
fsGroup: 1000
5354
runAsGroup: 1000
5455
runAsNonRoot: true
5556
runAsUser: 1000
57+
{{- end }}
5658
{{- if .Values.seccompProfile.enable }}
5759
seccompProfile:
5860
type: {{ .Values.seccompProfile.type }}

helm-chart/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ seccompProfile:
5656
enable: false
5757
type: RuntimeDefault
5858

59+
securityContext:
60+
enable: true
61+
5962
adService:
6063
create: true
6164
name: adservice

0 commit comments

Comments
 (0)