Skip to content

Commit 299aa5d

Browse files
authored
Merge pull request kubernetes#76505 from rosti/fix-join-cri-detection
kubeadm: Don't error out on join with --cri-socket override
2 parents 8c4651c + 2d4307d commit 299aa5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/kubeadm/app/util/config/cluster.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ func getInitConfigurationFromCluster(kubeconfigDir string, client clientset.Inte
9393
if err := getAPIEndpoint(configMap.Data, initcfg.NodeRegistration.Name, &initcfg.LocalAPIEndpoint); err != nil {
9494
return nil, errors.Wrap(err, "failed to getAPIEndpoint")
9595
}
96+
} else {
97+
// In the case where newControlPlane is true we don't go through getNodeRegistration() and initcfg.NodeRegistration.CRISocket is empty.
98+
// This forces DetectCRISocket() to be called later on, and if there is more than one CRI installed on the system, it will error out,
99+
// while asking for the user to provide an override for the CRI socket. Even if the user provides an override, the call to
100+
// DetectCRISocket() can happen too early and thus ignore it (while still erroring out).
101+
// However, if newControlPlane == true, initcfg.NodeRegistration is not used at all and it's overwritten later on.
102+
// Thus it's necessary to supply some default value, that will avoid the call to DetectCRISocket() and as
103+
// initcfg.NodeRegistration is discarded, setting whatever value here is harmless.
104+
initcfg.NodeRegistration.CRISocket = constants.DefaultDockerCRISocket
96105
}
97106
return initcfg, nil
98107
}

0 commit comments

Comments
 (0)