Implement experimental modifier for NVIDIA Container Runtime

This change enables the experimental mode of the NVIDIA Container Runtime. If
enabled, the nvidia-container-runtime.discover-mode config option is
queried to determine how required OCI spec modifications should be defined.
If "legacy" is selected, the existing NVIDIA Container Runtime hooks is
discovered and injected into the OCI spec.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2022-03-15 14:29:14 +02:00
parent 9dfe60b8b7
commit 239b6d3739
10 changed files with 531 additions and 20 deletions

View File

@@ -46,9 +46,13 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config.RuntimeConfig,
var specModifier oci.SpecModifier
if cfg.Experimental {
return nil, fmt.Errorf("experimental mode is not supported")
specModifier, err = modifier.NewExperimentalModifier(logger, cfg)
if err != nil {
return nil, fmt.Errorf("failed to construct experimental modifier: %v", err)
}
} else {
specModifier = modifier.NewStableRuntimeModifier(logger)
}
specModifier = modifier.NewStableRuntimeModifier(logger)
// Create the wrapping runtime with the specified modifier
r := runtime.NewModifyingRuntimeWrapper(