system-upgrade-controller icon indicating copy to clipboard operation
system-upgrade-controller copied to clipboard

Provide optional upgrade window setting to limit when a plan can run

Open bashofmann opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. It would be great if you could limit the execution of a plan to a specific timeframe, so that the upgrade jobs of a plan can for example only run:

  • between 2am and 4am
  • every Wednesday between 2pm and 6pm
  • ...

Describe the solution you'd like I was thinking about adding to configurations upgrade-window-start and upgrade-window-length that work similar to the reboot windows in the container-linux-update-operator (https://github.com/coreos/container-linux-update-operator/blob/master/doc/reboot-windows.md). The configuration flags could be optionally added as annotations to a Node and the system-upgrade-controller would only schedule a Job on this node if the current time is currently within this timeframe. By adding the configuration to the Node one could easily configure different upgrade windows on different set of nodes within a cluster. A node setting would affect all plans the same way.

Describe alternatives you've considered Another option would be to add the configuration flags globally to the system-upgrade-controller as environment variables and/or CLI arguments, but this would decrease the flexibility.

In addition the configuration flag could als be set as a field in the spec of a plan, but I'd propose to discuss this independently, because it adds more complexity to the feature:

  • What happens when the upgrade window of a plan conflicts with the upgrade window of Nodes? The plan would never run them.
  • How would an upgrade window setting of a plan interact with a use case where you want to schedule plans in a cron like way? Is this even something that should be supported or is the channel feature a better solution for this use-case?

Because of this I feel starting with adding these settings to Nodes is a good first step, that would already solve a large amount of use-cases.

Additional context Once we decide on an implementation, I'll be happy to implement it and create a PR for this.

bashofmann avatar Apr 16 '20 11:04 bashofmann

Defining maintenance windows would be a very useful feature for us as well.

mstrent avatar Aug 09 '21 23:08 mstrent

We could really use this. Upgrading during peak hours or weekends is not ideal for us.

ddfreiling avatar Oct 05 '23 21:10 ddfreiling

Would like to have that feature as well. I'm about to pitch the use of system-upgrade-controller for a larger project with a few hundred small (one-node) edge clusters. As they are one-node clusters, they should not upgrade during peak hours.

I propose something like Kured has: https://kured.dev/docs/configuration/#setting-a-schedule with those four options, most of the use-cases can be addressed IMHO.

For configuration, I suggest an extension to the schema of the Plan object:

spec:
  maintenance:
    weekdays: "mon,thu"
    start-time: 7pm
    end-time: 10pm
    time-zone: America/Los_Angeles

tuxpeople avatar Nov 03 '23 07:11 tuxpeople

It looks like kured did a nice job of packaging up their timewindow code in a reusable package, we could probably just pull that in directly.

https://github.com/kubereboot/kured/tree/main/pkg/timewindow

brandond avatar Nov 07 '23 18:11 brandond