In both jobs-api and webservices we need to review the pod templates. Previously, the PodSecurityPolicy mechanism would mutate Pod resources to meet the security criteria.
With T279110: [infra] Replace PodSecurityPolicy in Toolforge Kubernetes this will no longer be the case, so we need to natively create Pod resources with a configuration that matches both PSP and the replacement policy, a Kyverno policy. At least during the migration period.
For example, we could make sure our templates include:
securityContext: allowPrivilegeEscalation: false runAsNonRoot: true privileged: false hostNetwork: false hostIPC: false hostPID: false capabilities: drop: - ALL seccompProfile: type: "runtime/default"
In other words, Pods created both pre-PSP and post-PSP need to validate against the same kyverno policies.
See pod-level securityContext documentation here: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#podsecuritycontext-v1-core
See container-level securityContext documentation here: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#securitycontext-v1-core