kartikgoel598 commented on issue #6963:
URL: https://github.com/apache/camel-k/issues/6963#issuecomment-6969812910

   Hi @squakez, quick update.
   
   I wrote the test with three cases and ran it on my fork's common workflow. 
The default and custom-values cases pass. The root case fails: with 
run-as-user=0 and run-as-non-root=true, the container still starts as root, and 
the test times out waiting for CreateContainerConfigError.
   
   I think I found why. The container trait always sets a container-level 
securityContext, and its runAsNonRoot defaults to false 
(defaultContainerRunAsNonRoot in pkg/trait/container.go). Since container-level 
fields override pod-level ones, the runAsNonRoot: true set by the 
security-context trait doesn't take effect, and the container inherits 
runAsUser: 0 from the pod.
   
   Adding -t container.run-as-non-root=true makes the kubelet block it, but 
then the test is really checking the container trait.
   
   How would you like me to handle it? I could keep the root case using the 
container trait option and add a comment explaining why, or drop that case from 
this PR and open a separate issue about the override. Or let me know if this 
behaviour is expected.


-- 
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