fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Scheduled rollout

Open Athosone opened this issue 2 years ago • 10 comments

Feature description

This feature allows you to plan a deployment at a given period.

A period is composed of a cron and a duration.

Both of these properties represents a window during which the application can be deployed.

The schedule can be applied to either the cluster itself and/or the bundle.

If schedules are set on both the cluster and the bundle then the bundle schedule takes priority over the cluster schedule.

We chose to prioritise the bundle over the cluster as we think that the user may want to specify exceptions to the global rule of a cluster schedule.

Usage Example

fleet.yaml

defaultNamespace: default
namespace: default

schedule:
  cron: "0 16 * * *"
  duration: "1h"

cluster

apiVersion: fleet.cattle.io/v1alpha1
kind: Cluster
metadata:
  name: c-kd88w
  namespace: fleet-default
spec:
  paused: false
  deploymentSchedule:
    cron: "0 16 * * *"
    duration: "1h"

Motivation for this PR

We noticed there was an existing PR rancher/fleet#450 for this feature related to rancher/fleet#383, but saw that there was no activity on it.

Also there were two implementation details that were not right in our opinion:

  • If the agent was triggered during the schedule window, it would be skipped and be scheduled for the next. If your window was large (days, weeks, months), it would take a while for it to be installed.
  • If the bundle has already been scheduled (https://github.com/rancher/fleet/pull/450/files#diff-8b83e3ec81ef037af3e68026d07535637ca1d84af565be9bcda91135c4b80714R111), the nextRun was evaluated using the ScheduledAt and not computed using the cron and duration. This would result in the bundle being scheduled for the nextRun even if the cron and duration did not match the ScheduledAt anymore.

Athosone avatar Mar 08 '22 19:03 Athosone