backube / snapscheduler

Scheduled snapshots for Kubernetes persistent volumes
https://backube.github.io/snapscheduler/
GNU Affero General Public License v3.0
262 stars 26 forks source link

Create immediate snapshot ability and boolean for schedules with longer intervals. #309

Open croadfeldt opened 1 year ago

croadfeldt commented 1 year ago

Describe the feature you'd like to have. For longer snpashot intervals such as yearly snapshots, it would be nice to get an immediate snapshot and then honor the schedule as defined after that. This behavior could be turned on or off with a boolean.

eg; yearly cron: 0 0 1 1 * effective date: 2023-01-18 desired action: yearly snapshot created with 2023-01-18 snapshot, then next yearly snapshot on 2024-01-01

For that matter, every schedule could have a flag to create an immediate snapshot if no existing snapshots exist for that interval.

What is the value to the end user? (why is it a priority?) No manual snapshots needed at the beginning of the snapshot schedule. No manipulating cron entries to get semi-immediate initial snapshot made for each interval.

How will we know we have a good solution? (acceptance criteria) Each snapshot schedule adds a flag to create an immediate snapshot. When that flag is set and a schedule is implemented in a namespace, all relevant PVCs are snapshotted immediately and then on their defined schedules afterward.

Additional context If i get some time, will take a stab at pushing enough characters around the screen to million monkey shakespeare it, until then putting this RFE in. :)

kinoute commented 3 months ago

That would be great indeed to trigger manually a snapshot.

JohnStrunk commented 3 months ago

I'm not a big fan of adding lots of configuration options since it both complicates things for users as well as makes testing much harder.

In lieu of this option, you should be able to manually create a snapshot and apply a label w/ the name of the schedule you want it to belong to. It would then get expired according to the schedule's retention policy. For example, if you had a SnapshotSchedule named myschedule, you should be able to label a manually created VolumeSnapshot with:

metadata:
  labels:
    snapscheduler.backube/schedule: myschedule

The snapshot would then be treated as though it had been created by the myschedule schedule.