kartikgoel598 opened a new issue, #6983:
URL: https://github.com/apache/camel-k/issues/6983

   ### Bug description
   
   While writing the security-context e2e test (#6963), I found that the 
container trait always sets a container-level securityContext with 
runAsNonRoot: false by default (defaultContainerRunAsNonRoot in 
pkg/trait/container.go).
   
   Container-level fields override pod-level ones, so the runAsNonRoot: true 
set by the security-context trait has no effect at runtime. An Integration run 
with -t security-context.run-as-user=0 starts as root instead of being blocked.
   
   As discussed in #6963, the default should be true. The e2e test currently 
works around this with -t container.run-as-non-root=true and a TODO comment 
pointing to this issue.
   
   Things that would need updating:
   - defaultContainerRunAsNonRoot in pkg/trait/container.go
   - the "(default false)" comment on RunAsNonRoot in 
pkg/apis/camel/v1/trait/container.go, plus any generated docs or CRDs
   - the TODO in e2e/common/traits/security_context_test.go
   
   ### Camel K or runtime version
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to