mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
fetch current container runtime config through the command line
Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com> add default runtime binary path to runtimes field of toolkit config toml Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com> [no-relnote] Get low-level runtimes consistently We ensure that we use the same low-level runtimes regardless of the runtime engine being configured. This ensures consistent behaviour. Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com> address review comment Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/tools/container"
|
||||
)
|
||||
@@ -85,6 +86,7 @@ func Setup(c *cli.Context, o *container.Options, co *Options) error {
|
||||
|
||||
cfg, err := containerd.New(
|
||||
containerd.WithPath(o.Config),
|
||||
containerd.WithConfigSource(containerd.CommandLineSource(o.HostRootMount)),
|
||||
containerd.WithRuntimeType(co.runtimeType),
|
||||
containerd.WithUseLegacyConfig(co.useLegacyConfig),
|
||||
containerd.WithContainerAnnotations(co.containerAnnotationsFromCDIPrefixes()...),
|
||||
@@ -114,6 +116,7 @@ func Cleanup(c *cli.Context, o *container.Options, co *Options) error {
|
||||
|
||||
cfg, err := containerd.New(
|
||||
containerd.WithPath(o.Config),
|
||||
containerd.WithConfigSource(containerd.CommandLineSource(o.HostRootMount)),
|
||||
containerd.WithRuntimeType(co.runtimeType),
|
||||
containerd.WithUseLegacyConfig(co.useLegacyConfig),
|
||||
containerd.WithContainerAnnotations(co.containerAnnotationsFromCDIPrefixes()...),
|
||||
@@ -164,3 +167,15 @@ func (o *Options) runtimeConfigOverride() (map[string]interface{}, error) {
|
||||
|
||||
return runtimeOptions, nil
|
||||
}
|
||||
|
||||
func GetLowlevelRuntimePaths(o *container.Options, co *Options) ([]string, error) {
|
||||
cfg, err := containerd.New(
|
||||
containerd.WithConfigSource(containerd.CommandLineSource(o.HostRootMount)),
|
||||
containerd.WithRuntimeType(co.runtimeType),
|
||||
containerd.WithUseLegacyConfig(co.useLegacyConfig),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to load containerd config: %w", err)
|
||||
}
|
||||
return engine.GetBinaryPathsForRuntimes(cfg), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user