Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule creation thru API triggers backup regardless of cron settings #1980

Closed
funkycode opened this issue Oct 18, 2019 · 1 comment · Fixed by #4281
Closed

Schedule creation thru API triggers backup regardless of cron settings #1980

funkycode opened this issue Oct 18, 2019 · 1 comment · Fixed by #4281

Comments

@funkycode
Copy link
Contributor

funkycode commented Oct 18, 2019

I think it's known issue as according to comment in code (

// get the latest run time (if the schedule hasn't run yet, this will be the zero value which will trigger
)

func getNextRunTime(schedule *api.Schedule, cronSchedule cron.Schedule, asOf time.Time) (bool, time.Time) {
    // get the latest run time (if the schedule hasn't run yet, this will be the zero value which will trigger
    // an immediate backup)
    var lastBackupTime time.Time
    if schedule.Status.LastBackup != nil {
        lastBackupTime = schedule.Status.LastBackup.Time
    }
    nextRunTime := cronSchedule.Next(lastBackupTime)

What steps did you take and what happened:
Here is the simple code to create scheduler we use
schedulerBuilder := builder.ForSchedule( c.context, name, ).CronSchedule(cronString).Template(backupBuilder.Result().Spec).ObjectMeta( builder.WithLabels(defaults.TufinReleaseVersionLabel, tosVersion)) scheduler, err = c.client.Schedules(c.context).Create(schedulerBuilder.Result())

What did you expect to happen:
One of the following:

  1. Creation Date would be taken into account to calculate next run if schedule.Status.LastBackup.Time value is lower than creation date
  2. LastBackup.Time value would be set to creation date if not specified on creation of object
@skriss
Copy link
Contributor

skriss commented May 18, 2020

xref #2433

@skriss skriss closed this as completed May 18, 2020
@skriss skriss reopened this May 18, 2020
@eleanor-millman eleanor-millman added Reviewed Q2 2021 Icebox We see the value, but it is not slated for the next couple releases. labels May 10, 2021
@eleanor-millman eleanor-millman removed the Icebox We see the value, but it is not slated for the next couple releases. label May 20, 2021
@eleanor-millman eleanor-millman added this to the v1.8.0 milestone Aug 17, 2021
@ywk253100 ywk253100 self-assigned this Oct 20, 2021
ywk253100 added a commit to ywk253100/velero that referenced this issue Oct 26, 2021
Don't create a backup immediately after creating a schedule
Fixes vmware-tanzu#1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
ywk253100 added a commit to ywk253100/velero that referenced this issue Oct 26, 2021
Don't create a backup immediately after creating a schedule
Fixes vmware-tanzu#1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
dsu-igeek pushed a commit that referenced this issue Oct 26, 2021
Don't create a backup immediately after creating a schedule
Fixes #1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
danfengliu pushed a commit to danfengliu/velero that referenced this issue Jan 25, 2022
…anzu#4281)

Don't create a backup immediately after creating a schedule
Fixes vmware-tanzu#1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
ywk253100 added a commit to ywk253100/velero that referenced this issue Feb 16, 2022
Update release note to reflect the fix for vmware-tanzu#1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
reasonerjt added a commit that referenced this issue Feb 16, 2022
Update release note to reflect the fix for #1980
gyaozhou pushed a commit to gyaozhou/velero-read that referenced this issue May 14, 2022
…anzu#4281)

Don't create a backup immediately after creating a schedule
Fixes vmware-tanzu#1980

Signed-off-by: Wenkai Yin(尹文开) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants