Add security context to init containers -- Added unit test for it (#76)
* Add security context to init containers -- Added unit test for it * Minor cleaning --------- Co-authored-by: Laszlo Fogas <laszlo@gimlet.io>
This commit is contained in:
@@ -68,6 +68,10 @@ spec:
|
||||
name: {{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{if .securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml .securityContext | nindent 12 }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "robustName" .Release.Name }}
|
||||
|
||||
@@ -27,5 +27,12 @@ tests:
|
||||
path: spec.template.spec.initContainers[0].command
|
||||
value: ['/bin/sh', '-c', 'while true; do date; sleep 2; done && ls /data && printf something']
|
||||
|
||||
|
||||
|
||||
- it: Should set security context
|
||||
set:
|
||||
initContainers:
|
||||
- securityContext:
|
||||
runAsNonRoot: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].securityContext.runAsNonRoot
|
||||
value: true
|
||||
|
||||
Reference in New Issue
Block a user