mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
kubeadm: simplify creating etcdClient
There is no need to overshadow `client` with a transitive variable used solely for transfering its value to `etcdClient`.
This commit is contained in:
parent
d9f3e96796
commit
926d9012a4
@ -98,22 +98,17 @@ func runPlan(flags *planFlags, userVersion string) error {
|
|||||||
// external etcd vs static pod etcd
|
// external etcd vs static pod etcd
|
||||||
isExternalEtcd := cfg.Etcd.External != nil
|
isExternalEtcd := cfg.Etcd.External != nil
|
||||||
if isExternalEtcd {
|
if isExternalEtcd {
|
||||||
client, err := etcdutil.New(
|
etcdClient, err = etcdutil.New(
|
||||||
cfg.Etcd.External.Endpoints,
|
cfg.Etcd.External.Endpoints,
|
||||||
cfg.Etcd.External.CAFile,
|
cfg.Etcd.External.CAFile,
|
||||||
cfg.Etcd.External.CertFile,
|
cfg.Etcd.External.CertFile,
|
||||||
cfg.Etcd.External.KeyFile)
|
cfg.Etcd.External.KeyFile)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
etcdClient = client
|
|
||||||
} else {
|
} else {
|
||||||
// Connects to local/stacked etcd existing in the cluster
|
// Connects to local/stacked etcd existing in the cluster
|
||||||
client, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
etcdClient, err = etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
||||||
if err != nil {
|
}
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
etcdClient = client
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute which upgrade possibilities there are
|
// Compute which upgrade possibilities there are
|
||||||
|
Loading…
Reference in New Issue
Block a user