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

Function TransformSandboxValidator

controllers/object_controls.go:2364–2393  ·  view source on GitHub ↗

TransformSandboxValidator transforms nvidia-sandbox-validator daemonset with required config as per ClusterPolicy

(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController)

Source from the content-addressed store, hash-verified

2362
2363// TransformSandboxValidator transforms nvidia-sandbox-validator daemonset with required config as per ClusterPolicy
2364func TransformSandboxValidator(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController) error {
2365 err := TransformValidatorShared(obj, config)
2366 if err != nil {
2367 return fmt.Errorf("%v", err)
2368 }
2369
2370 var validatorErr error
2371 // apply changes for individual component validators(initContainers)
2372 components := []string{
2373 "cc-manager",
2374 "vfio-pci",
2375 "vgpu-manager",
2376 "vgpu-devices",
2377 }
2378
2379 for _, component := range components {
2380 if err := TransformValidatorComponent(config, &obj.Spec.Template.Spec, component); err != nil {
2381 validatorErr = errors.Join(validatorErr, err)
2382 }
2383 }
2384
2385 if validatorErr != nil {
2386 n.logger.Info("WARN: errors transforming the validator containers: %v", validatorErr)
2387 }
2388
2389 // set hostNetwork for sandbox-validator if specified
2390 applyHostNetworkConfig(&obj.Spec.Template.Spec, config.Validator.HostNetwork)
2391
2392 return nil
2393}
2394
2395// TransformValidatorShared applies general transformations to the validator daemonset with required config as per ClusterPolicy
2396func TransformValidatorShared(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec) error {

Callers 1

Calls 3

TransformValidatorSharedFunction · 0.85
applyHostNetworkConfigFunction · 0.85

Tested by 1