Skip to content

Commit f730b9d

Browse files
committed
Set cdi.enabled to true by default
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent 23a031e commit f730b9d

File tree

7 files changed

+27
-6
lines changed

7 files changed

+27
-6
lines changed

api/nvidia/v1/clusterpolicy_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ type VGPUDevicesConfigSpec struct {
16551655
type CDIConfigSpec struct {
16561656
// Enabled indicates whether CDI should be used as the mechanism for making GPUs accessible to containers.
16571657
// +kubebuilder:validation:Optional
1658-
// +kubebuilder:default=false
1658+
// +kubebuilder:default=true
16591659
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
16601660
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable CDI as the mechanism for making GPUs accessible to containers"
16611661
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
@@ -2065,7 +2065,7 @@ func (l *DriverLicensingConfigSpec) IsNLSEnabled() bool {
20652065
// providing GPU access to containers
20662066
func (c *CDIConfigSpec) IsEnabled() bool {
20672067
if c.Enabled == nil {
2068-
return false
2068+
return true
20692069
}
20702070
return *c.Enabled
20712071
}

bundle/manifests/gpu-operator-certified.clusterserviceversion.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ metadata:
3434
"initContainer": {
3535
}
3636
},
37+
"cdi": {
38+
"enabled": true
39+
},
3740
"sandboxWorkloads": {
3841
"enabled": false,
3942
"defaultWorkload": "container"

bundle/manifests/nvidia.com_clusterpolicies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
for making GPUs accessible to containers.'
142142
type: boolean
143143
enabled:
144-
default: false
144+
default: true
145145
description: Enabled indicates whether CDI should be used as the
146146
mechanism for making GPUs accessible to containers.
147147
type: boolean

config/crd/bases/nvidia.com_clusterpolicies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
for making GPUs accessible to containers.'
142142
type: boolean
143143
enabled:
144-
default: false
144+
default: true
145145
description: Enabled indicates whether CDI should be used as the
146146
mechanism for making GPUs accessible to containers.
147147
type: boolean

controllers/transforms_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ func TestTransformToolkit(t *testing.T) {
614614
},
615615
},
616616
Env: []corev1.EnvVar{
617+
{Name: CDIEnabledEnvName, Value: "true"},
618+
{Name: CrioConfigModeEnvName, Value: "config"},
619+
{Name: NvidiaRuntimeSetAsDefaultEnvName, Value: "false"},
620+
{Name: NvidiaCtrRuntimeModeEnvName, Value: "cdi"},
617621
{Name: "RUNTIME", Value: "containerd"},
618622
{Name: "CONTAINERD_RUNTIME_CLASS", Value: "nvidia"},
619623
{Name: "RUNTIME_CONFIG", Value: "/runtime/config-dir/config.toml"},
@@ -671,6 +675,10 @@ func TestTransformDevicePlugin(t *testing.T) {
671675
{Name: "foo", Value: "bar"},
672676
},
673677
},
678+
Toolkit: gpuv1.ToolkitSpec{
679+
Enabled: newBoolPtr(true),
680+
InstallDir: "/path/to/install",
681+
},
674682
},
675683
expectedDs: NewDaemonset().WithContainer(corev1.Container{
676684
Name: "nvidia-device-plugin-ctr",
@@ -679,6 +687,10 @@ func TestTransformDevicePlugin(t *testing.T) {
679687
Args: []string{"--fail-on-init-error=false"},
680688
Env: []corev1.EnvVar{
681689
{Name: "NVIDIA_MIG_MONITOR_DEVICES", Value: "all"},
690+
{Name: CDIEnabledEnvName, Value: "true"},
691+
{Name: DeviceListStrategyEnvName, Value: "cdi-annotations,cdi-cri"},
692+
{Name: CDIAnnotationPrefixEnvName, Value: "cdi.k8s.io/"},
693+
{Name: NvidiaCDIHookPathEnvName, Value: "/path/to/install/toolkit/nvidia-cdi-hook"},
682694
{Name: "foo", Value: "bar"},
683695
},
684696
}).WithContainer(corev1.Container{Name: "dummy"}).WithPullSecret("pull-secret").WithRuntimeClassName("nvidia"),
@@ -768,13 +780,19 @@ func TestTransformMigManager(t *testing.T) {
768780
{Name: "foo", Value: "bar"},
769781
},
770782
},
783+
Toolkit: gpuv1.ToolkitSpec{
784+
Enabled: newBoolPtr(true),
785+
InstallDir: "/path/to/install",
786+
},
771787
},
772788
expectedDs: NewDaemonset().WithContainer(corev1.Container{
773789
Name: "mig-manager",
774790
Image: "nvcr.io/nvidia/cloud-native/mig-manager:v1.0.0",
775791
ImagePullPolicy: corev1.PullIfNotPresent,
776792
Args: []string{"--test-flag"},
777793
Env: []corev1.EnvVar{
794+
{Name: CDIEnabledEnvName, Value: "true"},
795+
{Name: NvidiaCDIHookPathEnvName, Value: "/path/to/install/toolkit/nvidia-cdi-hook"},
778796
{Name: "foo", Value: "bar"},
779797
},
780798
}).WithPullSecret("pull-secret").WithRuntimeClassName("nvidia"),

deployments/gpu-operator/crds/nvidia.com_clusterpolicies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
for making GPUs accessible to containers.'
142142
type: boolean
143143
enabled:
144-
default: false
144+
default: true
145145
description: Enabled indicates whether CDI should be used as the
146146
mechanism for making GPUs accessible to containers.
147147
type: boolean

deployments/gpu-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ psa:
1313
enabled: false
1414

1515
cdi:
16-
enabled: false
16+
enabled: true
1717

1818
sandboxWorkloads:
1919
enabled: false

0 commit comments

Comments
 (0)