mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
Expose opt-in features in toolkit-container
This change enables opt-in (off-by-default) features to be opted into. These features can be toggled by name by specifying the (repeated) --opt-in-feature command line argument or as a comma-separated list in the NVIDIA_CONTAINER_TOOLKIT_OPT_IN_FEATURES environment variable. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
70da6cfa50
commit
9c2476c98d
@ -81,6 +81,8 @@ type options struct {
|
|||||||
acceptNVIDIAVisibleDevicesAsVolumeMounts bool
|
acceptNVIDIAVisibleDevicesAsVolumeMounts bool
|
||||||
|
|
||||||
ignoreErrors bool
|
ignoreErrors bool
|
||||||
|
|
||||||
|
optInFeatures cli.StringSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -250,6 +252,12 @@ func main() {
|
|||||||
Destination: &opts.createDeviceNodes,
|
Destination: &opts.createDeviceNodes,
|
||||||
EnvVars: []string{"CREATE_DEVICE_NODES"},
|
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
|
// 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-runtime.runtimes": opts.ContainerRuntimeRuntimes,
|
||||||
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
|
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
|
||||||
}
|
}
|
||||||
|
for _, feature := range opts.optInFeatures.Value() {
|
||||||
|
optionalConfigValues["features."+feature] = true
|
||||||
|
}
|
||||||
|
|
||||||
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