1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-31 14:36:32 +00:00

restore certificates to at least on etcd/control plane

This commit is contained in:
galal-hussein
2018-06-13 23:26:03 +02:00
committed by Alena Prokharchyk
parent cafc7218fb
commit 1f8113428e
2 changed files with 12 additions and 4 deletions

View File

@@ -265,14 +265,22 @@ func (c *Cluster) SaveBackupCertificateBundle(ctx context.Context) error {
func (c *Cluster) ExtractBackupCertificateBundle(ctx context.Context) error {
backupHosts := c.getBackupHosts()
var errgrp errgroup.Group
errList := []string{}
for _, host := range backupHosts {
runHost := host
errgrp.Go(func() error {
return pki.ExtractBackupBundleOnHost(ctx, runHost, c.SystemImages.Alpine, services.EtcdSnapshotPath, c.PrivateRegistriesMap)
if err := pki.ExtractBackupBundleOnHost(ctx, runHost, c.SystemImages.Alpine, services.EtcdSnapshotPath, c.PrivateRegistriesMap); err != nil {
errList = append(errList, fmt.Errorf(
"Failed to extract certificate bundle on host [%s], please make sure etcd bundle exist in /opt/rke/etcd-snapshots/pki.bundle.tar.gz: %v", runHost.Address, err).Error())
}
return nil
})
}
return errgrp.Wait()
errgrp.Wait()
if len(errList) == len(backupHosts) {
return fmt.Errorf(strings.Join(errList, ","))
}
return nil
}
func (c *Cluster) getBackupHosts() []*hosts.Host {