mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-02-18 10:18:40 +00:00
FIX: Factor out specModifier construction into function
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
e6730fd0f0
commit
11aa1d2a7d
@ -44,14 +44,9 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config.Config, argv [
|
|||||||
return nil, fmt.Errorf("error constructing low-level runtime: %v", err)
|
return nil, fmt.Errorf("error constructing low-level runtime: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var specModifier oci.SpecModifier
|
specModifier, err := newSpecModifier(logger, cfg)
|
||||||
if cfg.NVIDIAContainerRuntimeConfig.Experimental {
|
|
||||||
specModifier, err = modifier.NewExperimentalModifier(logger, cfg)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to construct experimental modifier: %v", err)
|
return nil, fmt.Errorf("failed to construct OCI spec modifier: %v", err)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
specModifier = modifier.NewStableRuntimeModifier(logger)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the wrapping runtime with the specified modifier
|
// Create the wrapping runtime with the specified modifier
|
||||||
@ -64,3 +59,12 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config.Config, argv [
|
|||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newSpecModifier is a factory method that creates constructs an OCI spec modifer based on the provided config.
|
||||||
|
func newSpecModifier(logger *logrus.Logger, cfg *config.Config) (oci.SpecModifier, error) {
|
||||||
|
if !cfg.NVIDIAContainerRuntimeConfig.Experimental {
|
||||||
|
return modifier.NewStableRuntimeModifier(logger), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return modifier.NewExperimentalModifier(logger, cfg)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user