Skip to content

Commit

Permalink
Fix Backup name duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
learner0810 committed Oct 18, 2023
1 parent 5ff5073 commit f943972
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelogs/unreleased/6971-learner0810
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix Backup name duplication
3 changes: 2 additions & 1 deletion pkg/apis/velero/v1/schedule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apiserver/pkg/storage/names"
)

// ScheduleSpec defines the specification for a Velero schedule
Expand Down Expand Up @@ -124,5 +125,5 @@ type ScheduleList struct {

// TimestampedName returns the default backup name format based on the schedule
func (s *Schedule) TimestampedName(timestamp time.Time) string {
return fmt.Sprintf("%s-%s", s.Name, timestamp.Format("20060102150405"))
return names.SimpleNameGenerator.GenerateName(fmt.Sprintf("%s-%s-", s.Name, timestamp.Format("20060102150405")))
}

0 comments on commit f943972

Please sign in to comment.