Skip to content

Commit 014f66d

Browse files
committed
SecurityContextConstraints: only set runAsNonRoot when runAsUser is nil.
1 parent 5b2b98f commit 014f66d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/security/securitycontextconstraints/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (s *simpleProvider) CreateContainerSecurityContext(pod *api.Pod, container
203203
// if we're using the non-root strategy set the marker that this container should not be
204204
// run as root which will signal to the kubelet to do a final check either on the runAsUser
205205
// or, if runAsUser is not set, the image
206-
if s.scc.RunAsUser.Type == securityapi.RunAsUserStrategyMustRunAsNonRoot {
206+
if sc.RunAsNonRoot == nil && sc.RunAsUser == nil && s.scc.RunAsUser.Type == securityapi.RunAsUserStrategyMustRunAsNonRoot {
207207
nonRoot := true
208208
sc.RunAsNonRoot = &nonRoot
209209
}

0 commit comments

Comments
 (0)