Only container-runtime-endpoint wants RuntimeSocket path as URI

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2021-01-20 17:03:22 -08:00 committed by Brad Davidson
parent 06fda7accf
commit 8011697175
2 changed files with 8 additions and 2 deletions

View File

@ -479,7 +479,7 @@ func get(envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
}
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
nodeConfig.AgentConfig.RuntimeSocket = "unix://" + nodeConfig.Containerd.Address
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.Containerd.Address
} else {
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.ContainerRuntimeEndpoint
nodeConfig.AgentConfig.CNIPlugin = true

View File

@ -21,6 +21,8 @@ import (
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
)
const unixPrefix = "unix://"
func Agent(config *config.Agent) error {
rand.Seed(time.Now().UTC().UnixNano())
@ -97,9 +99,13 @@ func startKubelet(cfg *config.Agent) error {
}
if cfg.RuntimeSocket != "" {
argsMap["container-runtime"] = "remote"
argsMap["container-runtime-endpoint"] = cfg.RuntimeSocket
argsMap["containerd"] = cfg.RuntimeSocket
argsMap["serialize-image-pulls"] = "false"
if strings.HasPrefix(argsMap["container-runtime-endpoint"], unixPrefix) {
argsMap["container-runtime-endpoint"] = cfg.RuntimeSocket
} else {
argsMap["container-runtime-endpoint"] = unixPrefix + cfg.RuntimeSocket
}
} else if cfg.PauseImage != "" {
argsMap["pod-infra-container-image"] = cfg.PauseImage
}