mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +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
|
||||
isExternalEtcd := cfg.Etcd.External != nil
|
||||
if isExternalEtcd {
|
||||
client, err := etcdutil.New(
|
||||
etcdClient, err = etcdutil.New(
|
||||
cfg.Etcd.External.Endpoints,
|
||||
cfg.Etcd.External.CAFile,
|
||||
cfg.Etcd.External.CertFile,
|
||||
cfg.Etcd.External.KeyFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
etcdClient = client
|
||||
} else {
|
||||
// Connects to local/stacked etcd existing in the cluster
|
||||
client, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
etcdClient = client
|
||||
etcdClient, err = etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Compute which upgrade possibilities there are
|
||||
|
Loading…
Reference in New Issue
Block a user