When creating backup from schedule, allow default name (#2569)

* When creating backup from schedule, allow default name

Signed-off-by: Christoph Blecker <admin@toph.ca>
This commit is contained in:
Christoph Blecker
2020-05-28 12:31:25 -07:00
committed by GitHub
parent 40d8511f64
commit ceae7a2fdc
4 changed files with 35 additions and 9 deletions
+11 -1
View File
@@ -16,7 +16,12 @@ limitations under the License.
package v1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
"fmt"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ScheduleSpec defines the specification for a Velero schedule
type ScheduleSpec struct {
@@ -95,3 +100,8 @@ type ScheduleList struct {
Items []Schedule `json:"items"`
}
// 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"))
}