Skip to content

Commit b025a99

Browse files
committed
Allow nvcdi FeatureFlags to be configured for jit-cdi mode
This change allows users the posibility to explicitly specify feature flags for using the `jit-cdi` mode. This allows, for example, for users to opt-in to use nvsandboxutils in the default mode in addition to when generating CDI specs explicitly. Signed-off-by: Evan Lezar <[email protected]>
1 parent c69b4e4 commit b025a99

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

internal/config/runtime.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package config
1818

19+
import "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi"
20+
1921
// RuntimeConfig stores the config options for the NVIDIA Container Runtime
2022
type RuntimeConfig struct {
2123
DebugFilePath string `toml:"debug"`
@@ -31,6 +33,7 @@ type RuntimeConfig struct {
3133
type modesConfig struct {
3234
CSV csvModeConfig `toml:"csv"`
3335
CDI cdiModeConfig `toml:"cdi"`
36+
JitCDI jitCDIModeConfig `toml:"jit-cdi"`
3437
Legacy legacyModeConfig `toml:"legacy"`
3538
}
3639

@@ -43,6 +46,11 @@ type cdiModeConfig struct {
4346
AnnotationPrefixes []string `toml:"annotation-prefixes"`
4447
}
4548

49+
type jitCDIModeConfig struct {
50+
// NVCDIFeatureFlags sets a list of nvcdi features explicitly.
51+
NVCDIFeatureFlags []nvcdi.FeatureFlag `toml:"nvcdi-feature-flags,omitempty"`
52+
}
53+
4654
type csvModeConfig struct {
4755
MountSpecPath string `toml:"mount-spec-path"`
4856
}

internal/modifier/cdi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ func newAutomaticCDISpecModifier(logger logger.Interface, cfg *config.Config, de
192192
nvcdi.WithVendor(automaticDeviceVendor),
193193
nvcdi.WithClass(perModeDeviceClass[mode]),
194194
nvcdi.WithMode(mode),
195+
nvcdi.WithFeatureFlags(cfg.NVIDIAContainerRuntimeConfig.Modes.JitCDI.NVCDIFeatureFlags...),
195196
)
196197
if err != nil {
197198
return nil, fmt.Errorf("failed to construct CDI library for mode %q: %w", mode, err)

0 commit comments

Comments
 (0)