mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Fix etcd connect for join --control-plane
This commit is contained in:
parent
b6a0718858
commit
8a53031b4e
@ -126,14 +126,16 @@ func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client
|
|||||||
// The first case should be dropped in v1.14 when support for v1.12 clusters can be removed from the codebase.
|
// The first case should be dropped in v1.14 when support for v1.12 clusters can be removed from the codebase.
|
||||||
|
|
||||||
// Detect which type of etcd we are dealing with
|
// Detect which type of etcd we are dealing with
|
||||||
|
// Please note that this test can be executed only on master nodes during upgrades;
|
||||||
|
// For nodes where we are joining a new control plane node instead we should tolerate that the etcd manifest does not
|
||||||
|
// exists and try to connect to etcd using API server advertise address; as described above this will lead to a know isse
|
||||||
|
// for cluster created with v1.12, but a documented workaround will be provided
|
||||||
oldManifest := false
|
oldManifest := false
|
||||||
klog.V(1).Infoln("checking etcd manifest")
|
klog.V(1).Infoln("checking etcd manifest")
|
||||||
|
|
||||||
etcdManifestFile := constants.GetStaticPodFilepath(constants.Etcd, constants.GetStaticPodDirectory())
|
etcdManifestFile := constants.GetStaticPodFilepath(constants.Etcd, constants.GetStaticPodDirectory())
|
||||||
etcdPod, err := staticpod.ReadStaticPodFromDisk(etcdManifestFile)
|
etcdPod, err := staticpod.ReadStaticPodFromDisk(etcdManifestFile)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return nil, errors.Wrap(err, "error reading etcd manifest file")
|
|
||||||
}
|
|
||||||
etcdContainer := etcdPod.Spec.Containers[0]
|
etcdContainer := etcdPod.Spec.Containers[0]
|
||||||
for _, arg := range etcdContainer.Command {
|
for _, arg := range etcdContainer.Command {
|
||||||
if arg == "--listen-client-urls=https://127.0.0.1:2379" {
|
if arg == "--listen-client-urls=https://127.0.0.1:2379" {
|
||||||
@ -159,6 +161,7 @@ func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client
|
|||||||
|
|
||||||
return etcdClient, nil
|
return etcdClient, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// etcd is listening on localhost and API server advertise address, and
|
// etcd is listening on localhost and API server advertise address, and
|
||||||
// the etcd cluster can have more than one etcd members, so it is necessary to get the
|
// the etcd cluster can have more than one etcd members, so it is necessary to get the
|
||||||
|
Loading…
Reference in New Issue
Block a user