Helpers: Add ingress-nginx.defaultBackend.containerSecurityContext
.
Extracts the default backend `securityContext` into a template, as for the controller.
This commit is contained in:
parent
47ab4935a9
commit
8d056bfcbb
3 changed files with 20 additions and 10 deletions
|
@ -194,6 +194,23 @@ Create the name of the backend service account to use - only used when podsecuri
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Default backend container security context.
|
||||||
|
*/}}
|
||||||
|
{{- define "ingress-nginx.defaultBackend.containerSecurityContext" -}}
|
||||||
|
{{- if .Values.defaultBackend.containerSecurityContext -}}
|
||||||
|
{{- toYaml .Values.defaultBackend.containerSecurityContext -}}
|
||||||
|
{{- else -}}
|
||||||
|
runAsNonRoot: {{ .Values.defaultBackend.image.runAsNonRoot }}
|
||||||
|
runAsUser: {{ .Values.defaultBackend.image.runAsUser }}
|
||||||
|
allowPrivilegeEscalation: {{ .Values.defaultBackend.image.allowPrivilegeEscalation }}
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
readOnlyRootFilesystem: {{ .Values.defaultBackend.image.readOnlyRootFilesystem}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Return the appropriate apiGroup for PodSecurityPolicy.
|
Return the appropriate apiGroup for PodSecurityPolicy.
|
||||||
*/}}
|
*/}}
|
||||||
|
|
|
@ -65,14 +65,7 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
securityContext:
|
securityContext: {{ include "ingress-nginx.defaultBackend.containerSecurityContext" . | nindent 12 }}
|
||||||
capabilities:
|
|
||||||
drop:
|
|
||||||
- ALL
|
|
||||||
runAsUser: {{ .Values.defaultBackend.image.runAsUser }}
|
|
||||||
runAsNonRoot: {{ .Values.defaultBackend.image.runAsNonRoot }}
|
|
||||||
allowPrivilegeEscalation: {{ .Values.defaultBackend.image.allowPrivilegeEscalation }}
|
|
||||||
readOnlyRootFilesystem: {{ .Values.defaultBackend.image.readOnlyRootFilesystem}}
|
|
||||||
{{- if .Values.defaultBackend.extraEnvs }}
|
{{- if .Values.defaultBackend.extraEnvs }}
|
||||||
env: {{ toYaml .Values.defaultBackend.extraEnvs | nindent 12 }}
|
env: {{ toYaml .Values.defaultBackend.extraEnvs | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -799,11 +799,11 @@ defaultBackend:
|
||||||
## repository:
|
## repository:
|
||||||
tag: "1.5"
|
tag: "1.5"
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
|
runAsNonRoot: true
|
||||||
# nobody user -> uid 65534
|
# nobody user -> uid 65534
|
||||||
runAsUser: 65534
|
runAsUser: 65534
|
||||||
runAsNonRoot: true
|
|
||||||
readOnlyRootFilesystem: true
|
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
# -- Use an existing PSP instead of creating one
|
# -- Use an existing PSP instead of creating one
|
||||||
existingPsp: ""
|
existingPsp: ""
|
||||||
extraArgs: {}
|
extraArgs: {}
|
||||||
|
|
Loading…
Reference in a new issue