From fc2929455257ab13ee051a18a9eb774c5a9e5d2a Mon Sep 17 00:00:00 2001 From: Xun Jiang/Bruce Jiang <59276555+blackpiglet@users.noreply.github.com> Date: Wed, 17 Nov 2021 22:26:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20modify=20generated=20from=20schedule's?= =?UTF-8?q?=20backup=20name=20timestamp=20to=20UTC=20ti=E2=80=A6=20(#4353)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: modify generated from schedule's backup name timestamp to UTC timezone fix #4279 When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name. Signed-off-by: Xun Jiang * fix: modify generated from schedule's backup name timestamp to UTC timezone fix #4279 When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name. Signed-off-by: Xun Jiang * fix: modify generated from schedule's backup name timestamp to UTC timezone fix #4279 When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name. Signed-off-by: Xun Jiang * modify changelog description Reword the changelog description according to comments. Signed-off-by: Xun Jiang Co-authored-by: jxun Co-authored-by: Xun Jiang --- changelogs/unreleased/4353-jxun | 1 + pkg/cmd/cli/backup/create.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/4353-jxun diff --git a/changelogs/unreleased/4353-jxun b/changelogs/unreleased/4353-jxun new file mode 100644 index 000000000..310a9e632 --- /dev/null +++ b/changelogs/unreleased/4353-jxun @@ -0,0 +1 @@ +Modify the timestamp in the name of a backup generated from schedule to use UTC. diff --git a/pkg/cmd/cli/backup/create.go b/pkg/cmd/cli/backup/create.go index 9c1d4ffe1..e0eb06b5c 100644 --- a/pkg/cmd/cli/backup/create.go +++ b/pkg/cmd/cli/backup/create.go @@ -322,7 +322,7 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro return nil, err } if o.Name == "" { - o.Name = schedule.TimestampedName(time.Now()) + o.Name = schedule.TimestampedName(time.Now().UTC()) } backupBuilder = builder.ForBackup(namespace, o.Name). FromSchedule(schedule)