diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index 8175ed4e..c9d0db6a 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -81,6 +81,8 @@ type options struct { acceptNVIDIAVisibleDevicesAsVolumeMounts bool ignoreErrors bool + + optInFeatures cli.StringSlice } func main() { @@ -250,6 +252,12 @@ func main() { Destination: &opts.createDeviceNodes, EnvVars: []string{"CREATE_DEVICE_NODES"}, }, + &cli.StringSliceFlag{ + Name: "opt-in-feature", + Hidden: true, + Destination: &opts.optInFeatures, + EnvVars: []string{"NVIDIA_CONTAINER_TOOLKIT_OPT_IN_FEATURES"}, + }, } // Update the subcommand flags with the common subcommand flags @@ -518,6 +526,10 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai "nvidia-container-runtime.runtimes": opts.ContainerRuntimeRuntimes, "nvidia-container-cli.debug": opts.ContainerCLIDebug, } + for _, feature := range opts.optInFeatures.Value() { + optionalConfigValues["features."+feature] = true + } + for key, value := range optionalConfigValues { if !c.IsSet(key) { log.Infof("Skipping unset option: %v", key)