@@ -73,6 +73,8 @@ type options struct {
7373 ignorePatterns []string
7474 }
7575
76+ noAllDevice bool
77+
7678 // the following are used for dependency injection during spec generation.
7779 nvmllib nvml.Interface
7880}
@@ -232,6 +234,12 @@ func (m command) build() *cli.Command {
232234 Destination : & opts .featureFlags ,
233235 Sources : cli .EnvVars ("NVIDIA_CTK_CDI_GENERATE_FEATURE_FLAGS" ),
234236 },
237+ & cli.BoolFlag {
238+ Name : "no-all-device" ,
239+ Usage : "Don't generate an `all` device for the resultant spec" ,
240+ Destination : & opts .noAllDevice ,
241+ Sources : cli .EnvVars ("NVIDIA_CTK_CDI_GENERATE_NO_ALL_DEVICE" ),
242+ },
235243 },
236244 }
237245
@@ -387,13 +395,18 @@ func (m command) generateSpecs(opts *options) ([]generatedSpecs, error) {
387395 spec .WithVendor (opts .vendor ),
388396 spec .WithEdits (* commonEdits .ContainerEdits ),
389397 spec .WithFormat (opts .format ),
390- spec .WithMergedDeviceOptions (
391- transform .WithName (allDeviceName ),
392- transform .WithSkipIfExists (true ),
393- ),
394398 spec .WithPermissions (0644 ),
395399 }
396400
401+ if ! opts .noAllDevice {
402+ commonSpecOptions = append (commonSpecOptions ,
403+ spec .WithMergedDeviceOptions (
404+ transform .WithName (allDeviceName ),
405+ transform .WithSkipIfExists (true ),
406+ ),
407+ )
408+ }
409+
397410 fullSpec , err := spec .New (
398411 append (commonSpecOptions ,
399412 spec .WithClass (opts .class ),
0 commit comments