Skip to content

Commit 9b37ad1

Browse files
committed
Make the cdi.default field a no-op
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent 5f5da39 commit 9b37ad1

File tree

8 files changed

+35
-50
lines changed

8 files changed

+35
-50
lines changed

api/nvidia/v1/clusterpolicy_types.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,20 +1653,20 @@ type VGPUDevicesConfigSpec struct {
16531653

16541654
// CDIConfigSpec defines how the Container Device Interface is used in the cluster.
16551655
type CDIConfigSpec struct {
1656-
// Enabled indicates whether CDI can be used to make GPUs accessible to containers.
1656+
// Enabled indicates whether CDI should be used as the mechanism for making GPUs accessible to containers.
16571657
// +kubebuilder:validation:Optional
16581658
// +kubebuilder:default=false
16591659
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
1660-
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable CDI as a mechanism for making GPUs accessible to containers"
1660+
// +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"
16621662
Enabled *bool `json:"enabled,omitempty"`
16631663

1664-
// Default indicates whether to use CDI as the default mechanism for providing GPU access to containers.
1664+
// Deprecated: This field is no longer used. Setting cdi.enabled=true will configure CDI as the default mechanism for making GPUs accessible to containers.
16651665
// +kubebuilder:validation:Optional
16661666
// +kubebuilder:default=false
16671667
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
1668-
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Configure CDI as the default mechanism for making GPUs accessible to containers"
1669-
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
1668+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Deprecated: This field is no longer used"
1669+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch,urn:alm:descriptor:com.tectonic.ui:hidden"
16701670
Default *bool `json:"default,omitempty"`
16711671
}
16721672

@@ -2070,15 +2070,6 @@ func (c *CDIConfigSpec) IsEnabled() bool {
20702070
return *c.Enabled
20712071
}
20722072

2073-
// IsDefault returns true if CDI is enabled as the default
2074-
// mechanism for providing GPU access to containers
2075-
func (c *CDIConfigSpec) IsDefault() bool {
2076-
if c.Default == nil {
2077-
return false
2078-
}
2079-
return *c.Default
2080-
}
2081-
20822073
// IsEnabled returns true if Kata Manager is enabled
20832074
func (k *KataManagerSpec) IsEnabled() bool {
20842075
if k.Enabled == nil {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,20 @@ spec:
534534
path: toolkit.imagePullPolicy
535535
x-descriptors:
536536
- 'urn:alm:descriptor:com.tectonic.ui:imagePullPolicy'
537+
- displayName: CDI
538+
description: Container Device Interface (CDI) Configuration
539+
path: cdi
540+
- displayName: Enabled
541+
description: 'Enabled indicates whether CDI should be used as the mechanism for making GPUs accessible to containers.'
542+
path: cdi.enabled
543+
x-descriptors:
544+
- 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
545+
- displayName: Default
546+
description: 'Deprecated: This field is no longer used. Setting cdi.enabled=true will configure CDI as the default mechanism for making GPUs accessible to containers.'
547+
path: cdi.default
548+
x-descriptors:
549+
- 'urn:alm:descriptor:com.tectonic.ui:hidden'
550+
- 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
537551
- displayName: NVIDIA DCGM config
538552
description: NVIDIA DCGM config
539553
path: dcgm

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
@@ -1237,10 +1237,7 @@ func transformToolkitForCDI(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySp
12371237
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), CDIEnabledEnvName, "true")
12381238
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), CrioConfigModeEnvName, "config")
12391239
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaRuntimeSetAsDefaultEnvName, "false")
1240-
1241-
if config.CDI.IsDefault() {
1242-
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaCtrRuntimeModeEnvName, "cdi")
1243-
}
1240+
setContainerEnv(&(obj.Spec.Template.Spec.Containers[0]), NvidiaCtrRuntimeModeEnvName, "cdi")
12441241
}
12451242

12461243
// TransformToolkit transforms Nvidia container-toolkit daemonset with required config as per ClusterPolicy

controllers/transforms_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,25 +1597,6 @@ func TestTransformToolkitForCDI(t *testing.T) {
15971597
Enabled: newBoolPtr(true),
15981598
},
15991599
},
1600-
expectedDs: NewDaemonset().WithContainer(
1601-
corev1.Container{
1602-
Name: "main-ctr",
1603-
Env: []corev1.EnvVar{
1604-
{Name: CDIEnabledEnvName, Value: "true"},
1605-
{Name: CrioConfigModeEnvName, Value: "config"},
1606-
{Name: NvidiaRuntimeSetAsDefaultEnvName, Value: "false"},
1607-
},
1608-
}),
1609-
},
1610-
{
1611-
description: "cdi enabled and cdi default",
1612-
ds: NewDaemonset().WithContainer(corev1.Container{Name: "main-ctr"}),
1613-
cpSpec: &gpuv1.ClusterPolicySpec{
1614-
CDI: gpuv1.CDIConfigSpec{
1615-
Enabled: newBoolPtr(true),
1616-
Default: newBoolPtr(true),
1617-
},
1618-
},
16191600
expectedDs: NewDaemonset().WithContainer(
16201601
corev1.Container{
16211602
Name: "main-ctr",

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:

deployments/gpu-operator/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ psa:
1414

1515
cdi:
1616
enabled: false
17-
default: false
1817

1918
sandboxWorkloads:
2019
enabled: false

0 commit comments

Comments
 (0)