Neuvector CronJob violate PodSecurity

Currently we are not setting any securityContext on neuvector-updater CronJob of neuvector. This will lead to mgmt-cronjob-testing CI job to fail with:

Warning: would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "neuvector-updater-pod" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "neuvector-updater-pod" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "neuvector-updater-pod" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "neuvector-updater-pod" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")

Reference job can be found here.

We need to set the right securityContext on the specific CronJob. Also, as an important confirmation step, we need to ensure that the CronJob is running and completed successfully. This could be tested either in our CI by the mgmt-cronjob-testing job or locally by running .gitlab/ci/scripts/cronjob-test.sh with the appropriate KUBECONFIG.

There was some work done under !3483 (closed), but it lead to other issues. For more context, please also see the discussion from !3470 (merged).

Edited Jan 22, 2025 by Dragos Gerea
Assignee Loading
Time tracking Loading