mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-02-22 12:17:53 +00:00
Skip injection of nvidia-persistenced socket by default
This changes skips the injection of the nvidia-persistenced socket by default. An include-persistenced-socket feature flag is added to allow the injection of this socket to be explicitly requested. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
72a0400a68
commit
c1f35807ea
@ -89,6 +89,12 @@ func doPrestart() {
|
|||||||
rootfs := getRootfsPath(container)
|
rootfs := getRootfsPath(container)
|
||||||
|
|
||||||
args := []string{getCLIPath(cli)}
|
args := []string{getCLIPath(cli)}
|
||||||
|
|
||||||
|
// Only include the nvidia-persistenced socket if it is explicitly enabled.
|
||||||
|
if !hook.Features.IncludePersistencedSocket.IsEnabled() {
|
||||||
|
args = append(args, "--no-persistenced")
|
||||||
|
}
|
||||||
|
|
||||||
if cli.Root != "" {
|
if cli.Root != "" {
|
||||||
args = append(args, fmt.Sprintf("--root=%s", cli.Root))
|
args = append(args, fmt.Sprintf("--root=%s", cli.Root))
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ const (
|
|||||||
FeatureNVSWITCH = featureName("nvswitch")
|
FeatureNVSWITCH = featureName("nvswitch")
|
||||||
FeatureGDRCopy = featureName("gdrcopy")
|
FeatureGDRCopy = featureName("gdrcopy")
|
||||||
FeatureAllowLDConfigFromContainer = featureName("allow-ldconfig-from-container")
|
FeatureAllowLDConfigFromContainer = featureName("allow-ldconfig-from-container")
|
||||||
|
FeatureIncludePersistencedSocket = featureName("include-persistenced-socket")
|
||||||
)
|
)
|
||||||
|
|
||||||
// features specifies a set of named features.
|
// features specifies a set of named features.
|
||||||
@ -36,6 +37,9 @@ type features struct {
|
|||||||
// If this feature flag is not set to 'true' only host-rooted config paths
|
// If this feature flag is not set to 'true' only host-rooted config paths
|
||||||
// (i.e. paths starting with an '@' are considered valid)
|
// (i.e. paths starting with an '@' are considered valid)
|
||||||
AllowLDConfigFromContainer *feature `toml:"allow-ldconfig-from-container,omitempty"`
|
AllowLDConfigFromContainer *feature `toml:"allow-ldconfig-from-container,omitempty"`
|
||||||
|
// IncludePersistencedSocket enables the injection of the nvidia-persistenced
|
||||||
|
// socket into containers.
|
||||||
|
IncludePersistencedSocket *feature `toml:"include-persistenced-socket,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type feature bool
|
type feature bool
|
||||||
@ -57,6 +61,8 @@ func (fs features) IsEnabledInEnvironment(n featureName, in ...getenver) bool {
|
|||||||
// Features without envvar overrides
|
// Features without envvar overrides
|
||||||
case FeatureAllowLDConfigFromContainer:
|
case FeatureAllowLDConfigFromContainer:
|
||||||
return fs.AllowLDConfigFromContainer.IsEnabled()
|
return fs.AllowLDConfigFromContainer.IsEnabled()
|
||||||
|
case FeatureIncludePersistencedSocket:
|
||||||
|
return fs.IncludePersistencedSocket.IsEnabled()
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user