Skip to content

Commit 87eab91

Browse files
committed
Make the cdi.default field a no-op
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent 869a97f commit 87eab91

File tree

6 files changed

+21
-41
lines changed

6 files changed

+21
-41
lines changed

api/nvidia/v1/clusterpolicy_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,19 +1632,19 @@ type VGPUDevicesConfigSpec struct {
16321632

16331633
// CDIConfigSpec defines how the Container Device Interface is used in the cluster.
16341634
type CDIConfigSpec struct {
1635-
// Enabled indicates whether CDI can be used to make GPUs accessible to containers.
1635+
// Enabled indicates whether CDI should be used as the mechanism for making GPUs accessible to containers.
16361636
// +kubebuilder:validation:Optional
16371637
// +kubebuilder:default=false
16381638
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
1639-
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable CDI as a mechanism for making GPUs accessible to containers"
1639+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable CDI as the mechanism for making GPUs accessible to containers"
16401640
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
16411641
Enabled *bool `json:"enabled,omitempty"`
16421642

1643-
// Default indicates whether to use CDI as the default mechanism for providing GPU access to containers.
1643+
// Deprecated: This field is no longer used. Setting cdi.enabled=true will configure CDI as the default mechanism for making GPUs accessible to containers.
16441644
// +kubebuilder:validation:Optional
16451645
// +kubebuilder:default=false
16461646
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
1647-
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Configure CDI as the default mechanism for making GPUs accessible to containers"
1647+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Deprecated: This field is no longer used"
16481648
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
16491649
Default *bool `json:"default,omitempty"`
16501650
}

bundle/manifests/nvidia.com_clusterpolicies.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ spec:
136136
properties:
137137
default:
138138
default: false
139-
description: Default indicates whether to use CDI as the default
140-
mechanism for providing GPU access to containers.
139+
description: 'Deprecated: This field is no longer used. Setting
140+
cdi.enabled=true will configure CDI as the default mechanism
141+
for making GPUs accessible to containers.'
141142
type: boolean
142143
enabled:
143144
default: false
144-
description: Enabled indicates whether CDI can be used to make
145-
GPUs accessible to containers.
145+
description: Enabled indicates whether CDI should be used as the
146+
mechanism for making GPUs accessible to containers.
146147
type: boolean
147148
type: object
148149
daemonsets:

config/crd/bases/nvidia.com_clusterpolicies.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ spec:
136136
properties:
137137
default:
138138
default: false
139-
description: Default indicates whether to use CDI as the default
140-
mechanism for providing GPU access to containers.
139+
description: 'Deprecated: This field is no longer used. Setting
140+
cdi.enabled=true will configure CDI as the default mechanism
141+
for making GPUs accessible to containers.'
141142
type: boolean
142143
enabled:
143144
default: false
144-
description: Enabled indicates whether CDI can be used to make
145-
GPUs accessible to containers.
145+
description: Enabled indicates whether CDI should be used as the
146+
mechanism for making GPUs accessible to containers.
146147
type: boolean
147148
type: object
148149
daemonsets:

controllers/object_controls.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,10 +1205,7 @@ func transformToolkitForCDI(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySp
12051205
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), CDIEnabledEnvName, "true")
12061206
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaCtrRuntimeCDIPrefixesEnvName, "nvidia.cdi.k8s.io/")
12071207
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), CrioConfigModeEnvName, "config")
1208-
1209-
if config.CDI.IsDefault() {
1210-
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaCtrRuntimeModeEnvName, "cdi")
1211-
}
1208+
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaCtrRuntimeModeEnvName, "cdi")
12121209

12131210
// When the container runtime supports CDI, we do not configure 'nvidia' as the default runtime.
12141211
// Instead, we leverage native CDI support in containerd / cri-o to inject GPUs into workloads.

controllers/transforms_test.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,26 +1196,6 @@ func TestTransformToolkitForCDI(t *testing.T) {
11961196
},
11971197
},
11981198
ctrl: ClusterPolicyController{},
1199-
expectedDs: NewDaemonset().WithContainer(
1200-
corev1.Container{
1201-
Name: "main-ctr",
1202-
Env: []corev1.EnvVar{
1203-
{Name: CDIEnabledEnvName, Value: "true"},
1204-
{Name: NvidiaCtrRuntimeCDIPrefixesEnvName, Value: "nvidia.cdi.k8s.io/"},
1205-
{Name: CrioConfigModeEnvName, Value: "config"},
1206-
},
1207-
}),
1208-
},
1209-
{
1210-
description: "cdi enabled, cdi default, runtime supports cdi",
1211-
ds: NewDaemonset().WithContainer(corev1.Container{Name: "main-ctr"}),
1212-
cpSpec: &gpuv1.ClusterPolicySpec{
1213-
CDI: gpuv1.CDIConfigSpec{
1214-
Enabled: newBoolPtr(true),
1215-
Default: newBoolPtr(true),
1216-
},
1217-
},
1218-
ctrl: ClusterPolicyController{},
12191199
expectedDs: NewDaemonset().WithContainer(
12201200
corev1.Container{
12211201
Name: "main-ctr",
@@ -1228,7 +1208,7 @@ func TestTransformToolkitForCDI(t *testing.T) {
12281208
}),
12291209
},
12301210
{
1231-
description: "cdi enabled, cdi default, runtime does not support cdi",
1211+
description: "cdi enabled, runtime does not support cdi",
12321212
ds: NewDaemonset().WithContainer(corev1.Container{Name: "main-ctr"}),
12331213
cpSpec: &gpuv1.ClusterPolicySpec{
12341214
CDI: gpuv1.CDIConfigSpec{

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ spec:
136136
properties:
137137
default:
138138
default: false
139-
description: Default indicates whether to use CDI as the default
140-
mechanism for providing GPU access to containers.
139+
description: 'Deprecated: This field is no longer used. Setting
140+
cdi.enabled=true will configure CDI as the default mechanism
141+
for making GPUs accessible to containers.'
141142
type: boolean
142143
enabled:
143144
default: false
144-
description: Enabled indicates whether CDI can be used to make
145-
GPUs accessible to containers.
145+
description: Enabled indicates whether CDI should be used as the
146+
mechanism for making GPUs accessible to containers.
146147
type: boolean
147148
type: object
148149
daemonsets:

0 commit comments

Comments
 (0)