Skip to content

Commit fba5d01

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

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

api/nvidia/v1/clusterpolicy_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,7 @@ type VGPUDevicesConfigSpec struct {
16601660
type CDIConfigSpec struct {
16611661
// Enabled indicates whether the Container Device Interface (CDI) should be used as the mechanism for making GPUs accessible to containers.
16621662
// +kubebuilder:validation:Optional
1663-
// +kubebuilder:default=false
1663+
// +kubebuilder:default=true
16641664
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
16651665
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable CDI as the mechanism for making GPUs accessible to containers"
16661666
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
@@ -2070,7 +2070,7 @@ func (l *DriverLicensingConfigSpec) IsNLSEnabled() bool {
20702070
// providing GPU access to containers
20712071
func (c *CDIConfigSpec) IsEnabled() bool {
20722072
if c.Enabled == nil {
2073-
return false
2073+
return true
20742074
}
20752075
return *c.Enabled
20762076
}

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 the Container Device Interface
146146
(CDI) should be used as the mechanism for making GPUs accessible
147147
to containers.

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 the Container Device Interface
146146
(CDI) should be used as the mechanism for making GPUs accessible
147147
to containers.

controllers/transforms_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ func TestTransformToolkit(t *testing.T) {
643643
},
644644
},
645645
Env: []corev1.EnvVar{
646+
{Name: CDIEnabledEnvName, Value: "true"},
647+
{Name: NvidiaRuntimeSetAsDefaultEnvName, Value: "false"},
648+
{Name: NvidiaCtrRuntimeModeEnvName, Value: "cdi"},
646649
{Name: "foo", Value: "bar"},
647650
{Name: "RUNTIME", Value: "containerd"},
648651
{Name: "CONTAINERD_RUNTIME_CLASS", Value: "nvidia"},
@@ -713,6 +716,9 @@ func TestTransformToolkit(t *testing.T) {
713716
},
714717
},
715718
Env: []corev1.EnvVar{
719+
{Name: CDIEnabledEnvName, Value: "true"},
720+
{Name: NvidiaRuntimeSetAsDefaultEnvName, Value: "false"},
721+
{Name: NvidiaCtrRuntimeModeEnvName, Value: "cdi"},
716722
{Name: "CONTAINERD_CONFIG", Value: "/runtime/config-dir/config.toml"},
717723
{Name: "CONTAINERD_SOCKET", Value: "/runtime/sock-dir/containerd.sock"},
718724
{Name: "CONTAINERD_RUNTIME_CLASS", Value: "nvidia"},
@@ -770,6 +776,10 @@ func TestTransformDevicePlugin(t *testing.T) {
770776
{Name: "foo", Value: "bar"},
771777
},
772778
},
779+
Toolkit: gpuv1.ToolkitSpec{
780+
Enabled: newBoolPtr(true),
781+
InstallDir: "/path/to/install",
782+
},
773783
},
774784
expectedDs: NewDaemonset().WithContainer(corev1.Container{
775785
Name: "nvidia-device-plugin",
@@ -778,6 +788,10 @@ func TestTransformDevicePlugin(t *testing.T) {
778788
Args: []string{"--fail-on-init-error=false"},
779789
Env: []corev1.EnvVar{
780790
{Name: "NVIDIA_MIG_MONITOR_DEVICES", Value: "all"},
791+
{Name: CDIEnabledEnvName, Value: "true"},
792+
{Name: DeviceListStrategyEnvName, Value: "cdi-annotations,cdi-cri"},
793+
{Name: CDIAnnotationPrefixEnvName, Value: "cdi.k8s.io/"},
794+
{Name: NvidiaCDIHookPathEnvName, Value: "/path/to/install/toolkit/nvidia-cdi-hook"},
781795
{Name: "foo", Value: "bar"},
782796
},
783797
}).WithContainer(corev1.Container{Name: "dummy"}).WithPullSecret("pull-secret").WithRuntimeClassName("nvidia"),
@@ -867,13 +881,19 @@ func TestTransformMigManager(t *testing.T) {
867881
{Name: "foo", Value: "bar"},
868882
},
869883
},
884+
Toolkit: gpuv1.ToolkitSpec{
885+
Enabled: newBoolPtr(true),
886+
InstallDir: "/path/to/install",
887+
},
870888
},
871889
expectedDs: NewDaemonset().WithContainer(corev1.Container{
872890
Name: "mig-manager",
873891
Image: "nvcr.io/nvidia/cloud-native/mig-manager:v1.0.0",
874892
ImagePullPolicy: corev1.PullIfNotPresent,
875893
Args: []string{"--test-flag"},
876894
Env: []corev1.EnvVar{
895+
{Name: CDIEnabledEnvName, Value: "true"},
896+
{Name: NvidiaCDIHookPathEnvName, Value: "/path/to/install/toolkit/nvidia-cdi-hook"},
877897
{Name: "foo", Value: "bar"},
878898
},
879899
}).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 the Container Device Interface
146146
(CDI) should be used as the mechanism for making GPUs accessible
147147
to containers.

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)