Create and delete SchedulePolicy with storkctl
This topic explains how to create and delete a SchedulePolicy using the storkctl command-line tool.
How to use the storkctl command?
To create a SchedulePolicy using storkctl, you can use the create schedulepolicy or create sp command with specific flags to define the schedule details.
In the storkctl create command, default values will be applied to all optional parameters in case you do not provide input. Additionally, validations are implemented that will generate relevant error messages in the event of invalid or incorrect inputs to the command.
Create an interval-based schedule policy
Run the following command to create a schedule policy with an interval-based recurrence. The specified operation associated with this schedule policy will be executed at regular intervals, and the interval duration is determined by the value provided with the -i flag:
storkctl create schedulepolicy <policy-name> \
-t Interval \
-i <interval-in-minutes> \
—-retain <number-of-backups-to-retain>
Example:
storkctl create schedulepolicy testpolicy -t Interval -i 1
kind: SchedulePolicy
metadata:
name: testpolicy
policy:
daily: null
interval:
intervalMinutes: 1
options: null
retain: 10
monthly: null
weekly: null
Create a daily schedule policy
Run the following command to create a schedule policy with a daily recurrence. The specified operation or task associated with this schedule policy will be executed at a particular time every day:
storkctl create schedulepolicy <policy-name> \
-t Daily --time <exact-time> \
—-retain <number-of-backups-to-retain> \
--force-full-snapshot-day <day-to-trigger-full-backup>
Example:
storkctl create schedulepolicy testpolicy -t Daily --time 10:14PM
apiVersion: stork.libopenstorage.org/v1alpha1
kind: SchedulePolicy
metadata:
name: testpolicy
policy:
daily:
forceFullSnapshotDay: monday
options: null
retain: 30
time: 10:14PM
interval: null
monthly: null
weekly: null
Create a weekly schedule policy
Run the following command to create a schedule policy with a weekly recurrence. The specified operation or task associated with this schedule policy will be executed at a particular time on a specific day of each week:
storkctl create schedulepolicy <policy-name> \
-t Weekly \
--day-of-week <day> \
--time <exact-time> \