mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
Merge pull request #741 from elezar/imex-default
Add disableIMEXChannelCreation feature flag
This commit is contained in:
commit
b077e2648d
@ -95,6 +95,9 @@ func doPrestart() {
|
|||||||
if cli.LoadKmods {
|
if cli.LoadKmods {
|
||||||
args = append(args, "--load-kmods")
|
args = append(args, "--load-kmods")
|
||||||
}
|
}
|
||||||
|
if hook.Features.DisableImexChannelCreation.IsEnabled() {
|
||||||
|
args = append(args, "--no-create-imex-channels")
|
||||||
|
}
|
||||||
if cli.NoPivot {
|
if cli.NoPivot {
|
||||||
args = append(args, "--no-pivot")
|
args = append(args, "--no-pivot")
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ package config
|
|||||||
|
|
||||||
// features specifies a set of named features.
|
// features specifies a set of named features.
|
||||||
type features struct {
|
type features struct {
|
||||||
|
// DisableImexChannelCreation ensures that the implicit creation of
|
||||||
|
// requested IMEX channels is skipped when invoking the nvidia-container-cli.
|
||||||
|
DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:unused
|
//nolint:unused
|
||||||
|
@ -79,6 +79,8 @@ type Options struct {
|
|||||||
acceptNVIDIAVisibleDevicesAsVolumeMounts bool
|
acceptNVIDIAVisibleDevicesAsVolumeMounts bool
|
||||||
|
|
||||||
ignoreErrors bool
|
ignoreErrors bool
|
||||||
|
|
||||||
|
optInFeatures cli.StringSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
func Flags(opts *Options) []cli.Flag {
|
func Flags(opts *Options) []cli.Flag {
|
||||||
@ -202,6 +204,12 @@ func Flags(opts *Options) []cli.Flag {
|
|||||||
Destination: &opts.createDeviceNodes,
|
Destination: &opts.createDeviceNodes,
|
||||||
EnvVars: []string{"CREATE_DEVICE_NODES"},
|
EnvVars: []string{"CREATE_DEVICE_NODES"},
|
||||||
},
|
},
|
||||||
|
&cli.StringSliceFlag{
|
||||||
|
Name: "opt-in-features",
|
||||||
|
Hidden: true,
|
||||||
|
Destination: &opts.optInFeatures,
|
||||||
|
EnvVars: []string{"NVIDIA_CONTAINER_TOOLKIT_OPT_IN_FEATURES"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags
|
return flags
|
||||||
@ -457,6 +465,10 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
|
|||||||
configValues["nvidia-container-runtime.runtimes"] = toolkitRuntimeList
|
configValues["nvidia-container-runtime.runtimes"] = toolkitRuntimeList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, optInFeature := range opts.optInFeatures.Value() {
|
||||||
|
configValues["features."+optInFeature] = true
|
||||||
|
}
|
||||||
|
|
||||||
for key, value := range configValues {
|
for key, value := range configValues {
|
||||||
cfg.Set(key, value)
|
cfg.Set(key, value)
|
||||||
}
|
}
|
||||||
@ -471,6 +483,7 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
|
|||||||
"nvidia-container-runtime.runtimes": opts.ContainerRuntimeRuntimes,
|
"nvidia-container-runtime.runtimes": opts.ContainerRuntimeRuntimes,
|
||||||
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
|
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, value := range optionalConfigValues {
|
for key, value := range optionalConfigValues {
|
||||||
if !c.IsSet(key) {
|
if !c.IsSet(key) {
|
||||||
log.Infof("Skipping unset option: %v", key)
|
log.Infof("Skipping unset option: %v", key)
|
||||||
|
Loading…
Reference in New Issue
Block a user