Skip to content

Commit c1f3580

Browse files
committed
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 <[email protected]>
1 parent 72a0400 commit c1f3580

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ func doPrestart() {
8989
rootfs := getRootfsPath(container)
9090

9191
args := []string{getCLIPath(cli)}
92+
93+
// Only include the nvidia-persistenced socket if it is explicitly enabled.
94+
if !hook.Features.IncludePersistencedSocket.IsEnabled() {
95+
args = append(args, "--no-persistenced")
96+
}
97+
9298
if cli.Root != "" {
9399
args = append(args, fmt.Sprintf("--root=%s", cli.Root))
94100
}

internal/config/features.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const (
2424
FeatureNVSWITCH = featureName("nvswitch")
2525
FeatureGDRCopy = featureName("gdrcopy")
2626
FeatureAllowLDConfigFromContainer = featureName("allow-ldconfig-from-container")
27+
FeatureIncludePersistencedSocket = featureName("include-persistenced-socket")
2728
)
2829

2930
// features specifies a set of named features.
@@ -36,6 +37,9 @@ type features struct {
3637
// If this feature flag is not set to 'true' only host-rooted config paths
3738
// (i.e. paths starting with an '@' are considered valid)
3839
AllowLDConfigFromContainer *feature `toml:"allow-ldconfig-from-container,omitempty"`
40+
// IncludePersistencedSocket enables the injection of the nvidia-persistenced
41+
// socket into containers.
42+
IncludePersistencedSocket *feature `toml:"include-persistenced-socket,omitempty"`
3943
}
4044

4145
type feature bool
@@ -57,6 +61,8 @@ func (fs features) IsEnabledInEnvironment(n featureName, in ...getenver) bool {
5761
// Features without envvar overrides
5862
case FeatureAllowLDConfigFromContainer:
5963
return fs.AllowLDConfigFromContainer.IsEnabled()
64+
case FeatureIncludePersistencedSocket:
65+
return fs.IncludePersistencedSocket.IsEnabled()
6066
default:
6167
return false
6268
}

0 commit comments

Comments
 (0)