Skip to content

Commit b077e26

Browse files
authored
Merge pull request #741 from elezar/imex-default
Add disableIMEXChannelCreation feature flag
2 parents ec8dfaf + 457d71c commit b077e26

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

cmd/nvidia-container-runtime-hook/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ func doPrestart() {
9595
if cli.LoadKmods {
9696
args = append(args, "--load-kmods")
9797
}
98+
if hook.Features.DisableImexChannelCreation.IsEnabled() {
99+
args = append(args, "--no-create-imex-channels")
100+
}
98101
if cli.NoPivot {
99102
args = append(args, "--no-pivot")
100103
}

internal/config/features.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ package config
1818

1919
// features specifies a set of named features.
2020
type features struct {
21+
// DisableImexChannelCreation ensures that the implicit creation of
22+
// requested IMEX channels is skipped when invoking the nvidia-container-cli.
23+
DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"`
2124
}
2225

2326
//nolint:unused

tools/container/toolkit/toolkit.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ type Options struct {
7979
acceptNVIDIAVisibleDevicesAsVolumeMounts bool
8080

8181
ignoreErrors bool
82+
83+
optInFeatures cli.StringSlice
8284
}
8385

8486
func Flags(opts *Options) []cli.Flag {
@@ -202,6 +204,12 @@ func Flags(opts *Options) []cli.Flag {
202204
Destination: &opts.createDeviceNodes,
203205
EnvVars: []string{"CREATE_DEVICE_NODES"},
204206
},
207+
&cli.StringSliceFlag{
208+
Name: "opt-in-features",
209+
Hidden: true,
210+
Destination: &opts.optInFeatures,
211+
EnvVars: []string{"NVIDIA_CONTAINER_TOOLKIT_OPT_IN_FEATURES"},
212+
},
205213
}
206214

207215
return flags
@@ -457,6 +465,10 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
457465
configValues["nvidia-container-runtime.runtimes"] = toolkitRuntimeList
458466
}
459467

468+
for _, optInFeature := range opts.optInFeatures.Value() {
469+
configValues["features."+optInFeature] = true
470+
}
471+
460472
for key, value := range configValues {
461473
cfg.Set(key, value)
462474
}
@@ -471,6 +483,7 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
471483
"nvidia-container-runtime.runtimes": opts.ContainerRuntimeRuntimes,
472484
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
473485
}
486+
474487
for key, value := range optionalConfigValues {
475488
if !c.IsSet(key) {
476489
log.Infof("Skipping unset option: %v", key)

0 commit comments

Comments
 (0)