diff --git a/cluster/etcd.go b/cluster/etcd.go index be821280..5c082f5a 100644 --- a/cluster/etcd.go +++ b/cluster/etcd.go @@ -68,15 +68,14 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error if err := docker.StopContainer(ctx, host.DClient, host.Address, services.EtcdContainerName); err != nil { log.Warnf(ctx, "failed to stop etcd container on host [%s]: %v", host.Address, err) } - if backupServer == nil { // start the download server, only one node should have it! - if err := services.StartBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath); err != nil { - log.Warnf(ctx, "failed to start backup server on host [%s]: %v", host.Address, err) - errors = append(errors, err) - continue - } - backupServer = host - break + // start the download server, only one node should have it! + if err := services.StartBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath); err != nil { + log.Warnf(ctx, "failed to start backup server on host [%s]: %v", host.Address, err) + errors = append(errors, err) + continue } + backupServer = host + break } if backupServer == nil { //failed to start the backupServer, I will cleanup and exit @@ -89,7 +88,7 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error } // start downloading the snapshot for _, host := range c.EtcdHosts { - if backupServer != nil && host.Address == backupServer.Address { // we skip the backup server if it's there + if host.Address == backupServer.Address { // we skip the backup server if it's there continue } if err := services.DownloadEtcdSnapshotFromBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath, backupServer); err != nil { diff --git a/services/etcd_util.go b/services/etcd_util.go index 78f322d8..c68ba926 100644 --- a/services/etcd_util.go +++ b/services/etcd_util.go @@ -140,8 +140,5 @@ func getEtcdTLSConfig(certificate, key []byte) (*tls.Config, error) { InsecureSkipVerify: true, Certificates: []tls.Certificate{x509Pair}, } - if err != nil { - return nil, err - } return tlsConfig, nil }