1
0
mirror of https://github.com/rancher/rke.git synced 2025-10-21 11:09:12 +00:00

Don't disable all backups based on backup flag

This commit is contained in:
moelsayed
2019-03-12 01:04:08 +02:00
committed by Alena Prokharchyk
parent b6d90f4110
commit 5d1084ad80
3 changed files with 3 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error
if !util.IsRancherBackupSupported(c.SystemImages.Alpine) {
log.Warnf(ctx, "Auto local backup sync is not supported in `%s`. Using `%s` instead.", c.SystemImages.Alpine, backupImage)
}
if c.Services.Etcd.BackupConfig == nil || (c.Services.Etcd.BackupConfig.Enabled != nil && !*c.Services.Etcd.BackupConfig.Enabled) || // legacy rke local backup
if c.Services.Etcd.BackupConfig == nil || // legacy rke local backup
(c.Services.Etcd.BackupConfig != nil && c.Services.Etcd.BackupConfig.S3BackupConfig == nil) { // rancher local backup, no s3
// stop etcd on all etcd nodes, we need this because we start the backup server on the same port
for _, host := range c.EtcdHosts {
@@ -102,7 +102,6 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error
// s3 backup case
if c.Services.Etcd.BackupConfig != nil &&
c.Services.Etcd.BackupConfig.Enabled != nil && *c.Services.Etcd.BackupConfig.Enabled &&
c.Services.Etcd.BackupConfig.S3BackupConfig != nil {
for _, host := range c.EtcdHosts {
if err := services.DownloadEtcdSnapshotFromS3(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath, c.Services.Etcd); err != nil {

View File

@@ -139,8 +139,7 @@ func validateServicesOptions(c *Cluster) error {
}
func validateEtcdBackupOptions(c *Cluster) error {
if c.Services.Etcd.BackupConfig != nil &&
c.Services.Etcd.BackupConfig.Enabled != nil && *c.Services.Etcd.BackupConfig.Enabled {
if c.Services.Etcd.BackupConfig != nil {
if c.Services.Etcd.BackupConfig.S3BackupConfig != nil {
if len(c.Services.Etcd.BackupConfig.S3BackupConfig.Endpoint) == 0 {
return fmt.Errorf("etcd s3 backup backend endpoint can't be empty")

View File

@@ -293,7 +293,7 @@ func RunEtcdSnapshotSave(ctx context.Context, etcdHost *hosts.Host, prsMap map[s
imageCfg.Cmd = append(imageCfg.Cmd, "--creation="+es.Creation)
}
if es.BackupConfig != nil && es.BackupConfig.Enabled != nil && *es.BackupConfig.Enabled {
if es.BackupConfig != nil {
imageCfg = configS3BackupImgCmd(ctx, imageCfg, es.BackupConfig)
}
hostCfg := &container.HostConfig{