mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Allow container runtime executable path to be specified
Some checks failed
Some checks failed
This change adds support for specifying the container runtime executable path. This can be used if, for example, there are two containerd or crio executables and a specific one must be used. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -162,8 +162,11 @@ func (c *Config) GetRuntimeConfig(name string) (engine.RuntimeConfig, error) {
|
||||
}
|
||||
|
||||
// CommandLineSource returns the CLI-based containerd config loader
|
||||
func CommandLineSource(hostRoot string) toml.Loader {
|
||||
return toml.FromCommandLine(chrootIfRequired(hostRoot, "containerd", "config", "dump")...)
|
||||
func CommandLineSource(hostRoot string, executablePath string) toml.Loader {
|
||||
if executablePath == "" {
|
||||
executablePath = "containerd"
|
||||
}
|
||||
return toml.FromCommandLine(chrootIfRequired(hostRoot, executablePath, "config", "dump")...)
|
||||
}
|
||||
|
||||
func chrootIfRequired(hostRoot string, commandLine ...string) []string {
|
||||
|
||||
@@ -157,9 +157,12 @@ func (c *Config) GetRuntimeConfig(name string) (engine.RuntimeConfig, error) {
|
||||
func (c *Config) EnableCDI() {}
|
||||
|
||||
// CommandLineSource returns the CLI-based crio config loader
|
||||
func CommandLineSource(hostRoot string) toml.Loader {
|
||||
func CommandLineSource(hostRoot string, executablePath string) toml.Loader {
|
||||
if executablePath == "" {
|
||||
executablePath = "crio"
|
||||
}
|
||||
return toml.LoadFirst(
|
||||
toml.FromCommandLine(chrootIfRequired(hostRoot, "crio", "status", "config")...),
|
||||
toml.FromCommandLine(chrootIfRequired(hostRoot, executablePath, "status", "config")...),
|
||||
toml.FromCommandLine(chrootIfRequired(hostRoot, "crio-status", "config")...),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user