mirror of https://github.com/k3s-io/k3s
PodSecurityPolicy: only set runAsNonRoot when runAsUser is nil
parent
b45b809f4c
commit
59510caaf3
|
@ -160,7 +160,7 @@ func (s *simpleProvider) CreateContainerSecurityContext(pod *api.Pod, container
|
||||||
// if we're using the non-root strategy set the marker that this container should not be
|
// if we're using the non-root strategy set the marker that this container should not be
|
||||||
// run as root which will signal to the kubelet to do a final check either on the runAsUser
|
// run as root which will signal to the kubelet to do a final check either on the runAsUser
|
||||||
// or, if runAsUser is not set, the image UID will be checked.
|
// or, if runAsUser is not set, the image UID will be checked.
|
||||||
if sc.RunAsNonRoot == nil && s.psp.Spec.RunAsUser.Rule == extensions.RunAsUserStrategyMustRunAsNonRoot {
|
if sc.RunAsNonRoot == nil && sc.RunAsUser == nil && s.psp.Spec.RunAsUser.Rule == extensions.RunAsUserStrategyMustRunAsNonRoot {
|
||||||
nonRoot := true
|
nonRoot := true
|
||||||
sc.RunAsNonRoot = &nonRoot
|
sc.RunAsNonRoot = &nonRoot
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue