MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / transformValidatorSecurityContext

Function transformValidatorSecurityContext

controllers/object_controls.go:2315–2320  ·  view source on GitHub ↗

transformValidatorSecurityContext updates the security context for a validator container so that it runs as uid 0. Some of the validations run commands that require root privileges (e.g. chroot). In addition, all validations create / delete status files in the '/run/nvidia/validations' host path vol

(ctr *corev1.Container)

Source from the content-addressed store, hash-verified

2313// volume. This directory is initially created by the kubelet and thus has
2314// the same group and ownership as the kubelet.
2315func transformValidatorSecurityContext(ctr *corev1.Container) {
2316 if ctr.SecurityContext == nil {
2317 ctr.SecurityContext = &corev1.SecurityContext{}
2318 }
2319 ctr.SecurityContext.RunAsUser = rootUID
2320}
2321
2322// TransformValidator transforms nvidia-operator-validator daemonset with required config as per ClusterPolicy
2323func TransformValidator(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController) error {

Calls

no outgoing calls

Tested by

no test coverage detected