Skip to content

Commit 2082e91

Browse files
committed
Prevent DRA driver and sandboxWorkloads from both being enabled
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
1 parent 4a047f3 commit 2082e91

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

controllers/clusterpolicy_validator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@ func validateDRA(clusterpolicy *gpuv1.ClusterPolicy, draSupported bool) error {
3939
return fmt.Errorf("the NVIDIA device plugin and the NVIDIA DRA driver for GPUs cannot both be enabled in ClusterPolicy")
4040
}
4141

42+
if clusterpolicy.Spec.SandboxWorkloads.IsEnabled() && clusterpolicy.Spec.DRADriver.IsEnabled() {
43+
return fmt.Errorf("sandboxWorkloads and the NVIDIA DRA driver for GPUs cannot both be enabled in ClusterPolicy")
44+
}
45+
4246
return nil
4347
}

deployments/gpu-operator/templates/validation.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212
{{- $error = printf "%s\nCannot enable the NVIDIA DRA Driver for GPUs on a Kubernetes cluster that does not support DRA" $error }}
1313
{{- fail $error }}
1414
{{- end}}
15+
16+
{{- if and ($draEnabled) (eq .Values.sandboxWorkloads.enabled true) }}
17+
{{- $error := "" }}
18+
{{- $error = printf "%s\nThe NVIDIA DRA Driver for GPUs and 'sandboxWorkloads' cannot both be enabled" $error }}
19+
{{- fail $error }}
20+
{{- end}}

0 commit comments

Comments
 (0)