Commit 8921f033 authored by Rostislav M. Georgiev's avatar Rostislav M. Georgiev Committed by Lubomir I. Ivanov

kubeadm: Don't error out on join with --cri-socket override

In the case where newControlPlane is true we don't go through getNodeRegistration() and initcfg.NodeRegistration.CRISocket is empty. This forces DetectCRISocket() to be called later on, and if there is more than one CRI installed on the system, it will error out, while asking for the user to provide an override for the CRI socket. Even if the user provides an override, the call to DetectCRISocket() can happen too early and thus ignore it (while still erroring out). However, if newControlPlane == true, initcfg.NodeRegistration is not used at all and it's overwritten later on. Thus it's necessary to supply some default value, that will avoid the call to DetectCRISocket() and as initcfg.NodeRegistration is discarded, setting whatever value here is harmless. Signed-off-by: 's avatarRostislav M. Georgiev <rostislavg@vmware.com>
parent 69b2bc0b
...@@ -93,6 +93,15 @@ func getInitConfigurationFromCluster(kubeconfigDir string, client clientset.Inte ...@@ -93,6 +93,15 @@ func getInitConfigurationFromCluster(kubeconfigDir string, client clientset.Inte
if err := getAPIEndpoint(configMap.Data, initcfg.NodeRegistration.Name, &initcfg.LocalAPIEndpoint); err != nil { if err := getAPIEndpoint(configMap.Data, initcfg.NodeRegistration.Name, &initcfg.LocalAPIEndpoint); err != nil {
return nil, errors.Wrap(err, "failed to getAPIEndpoint") return nil, errors.Wrap(err, "failed to getAPIEndpoint")
} }
} else {
// In the case where newControlPlane is true we don't go through getNodeRegistration() and initcfg.NodeRegistration.CRISocket is empty.
// This forces DetectCRISocket() to be called later on, and if there is more than one CRI installed on the system, it will error out,
// while asking for the user to provide an override for the CRI socket. Even if the user provides an override, the call to
// DetectCRISocket() can happen too early and thus ignore it (while still erroring out).
// However, if newControlPlane == true, initcfg.NodeRegistration is not used at all and it's overwritten later on.
// Thus it's necessary to supply some default value, that will avoid the call to DetectCRISocket() and as
// initcfg.NodeRegistration is discarded, setting whatever value here is harmless.
initcfg.NodeRegistration.CRISocket = constants.DefaultDockerCRISocket
} }
return initcfg, nil return initcfg, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment