Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

backup operator: fixed incorrect backup file naming convention. #2075

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/backup/backup_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/backup/writer/abs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2eslow/backup_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down