From cc2f4e84fc0a915b728d04692fcf8642dc0bd6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Carr=C3=A8re?= Date: Wed, 3 Apr 2019 15:08:06 +0100 Subject: [PATCH 1/3] Azure blob storage: use correct list prefix --- pkg/backup/writer/abs_writer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/backup/writer/abs_writer.go b/pkg/backup/writer/abs_writer.go index 743e5b758..eac27e7ed 100644 --- a/pkg/backup/writer/abs_writer.go +++ b/pkg/backup/writer/abs_writer.go @@ -103,7 +103,7 @@ func (absw *absWriter) Write(ctx context.Context, path string, r io.Reader) (int func (absw *absWriter) List(ctx context.Context, basePath string) ([]string, error) { // TODO: support context. - container, _, err := util.ParseBucketAndKey(basePath) + container, key, err := util.ParseBucketAndKey(basePath) if err != nil { return nil, err } @@ -118,7 +118,7 @@ func (absw *absWriter) List(ctx context.Context, basePath string) ([]string, err } blobs, err := containerRef.ListBlobs( - storage.ListBlobsParameters{Prefix: basePath}) + storage.ListBlobsParameters{Prefix: key}) if err != nil { return nil, err } From 10d2dd83ad1aaa057cfda50665b4135c10abd9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Carr=C3=A8re?= Date: Fri, 5 Apr 2019 16:41:01 +0100 Subject: [PATCH 2/3] backup operator: fixed incorrect backup file naming convention. When limiting the number of backups, if the revision would move to needing another digit, the logic would never select a new entry as _ is > to 9 in ascii terms. Note that this is backwards incompatible as now files receive a correct padding and old revisions will still be incorrectly handled. --- pkg/backup/backup_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/backup/backup_manager.go b/pkg/backup/backup_manager.go index a82ae32eb..3c1af3782 100644 --- a/pkg/backup/backup_manager.go +++ b/pkg/backup/backup_manager.go @@ -73,7 +73,7 @@ func (bm *BackupManager) SaveSnap(ctx context.Context, s3Path string, isPeriodic } defer rc.Close() if isPeriodic { - s3Path = fmt.Sprintf(s3Path+"_v%d_%s", rev, now.Format("2006-01-02-15:04:05")) + s3Path = fmt.Sprintf(s3Path+"_v%019d_%s", rev, now.Format("2006-01-02-15:04:05")) } _, err = bm.bw.Write(ctx, s3Path, rc) if err != nil { From b1bbc886b226ef7a64c99c138feeb7023860d9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Carr=C3=A8re?= Date: Mon, 8 Apr 2019 11:00:15 +0100 Subject: [PATCH 3/3] backup operator: adjust unit test to new file naming convention. --- test/e2e/e2eslow/backup_restore_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/e2eslow/backup_restore_test.go b/test/e2e/e2eslow/backup_restore_test.go index b387cc7af..1e9c8cd81 100644 --- a/test/e2e/e2eslow/backup_restore_test.go +++ b/test/e2e/e2eslow/backup_restore_test.go @@ -52,7 +52,7 @@ func TestBackupAndRestore(t *testing.T) { // Create cluster with TLS f := framework.Global - suffix := fmt.Sprintf("%d", rand.Uint64()) + suffix := fmt.Sprintf("%019d", rand.Uint64()) clusterName := "test-etcd-backup-restore-" + suffix memberPeerTLSSecret := "etcd-peer-tls-" + suffix memberClientTLSSecret := "etcd-server-tls-" + suffix