actions-runner-controller icon indicating copy to clipboard operation
actions-runner-controller copied to clipboard

Port ScheduledOverrides to AutoscalingRunnerSet

Open asafhm opened this issue 8 months ago • 8 comments

Fixes #3313 and #2986 (closed with no resolution)

Porting the great work by @mumoshu of the ScheduledOverrides capability of HorizontalRunnerAutoscaler to AutoscalingRunnerSet

How to use it

It's meant to be used in an almost identical way, with one exception - minReplicas was renamed to minRunners to conform with the current naming choice.

Examples:

  1. Within the AutoscalingRunnerSet CR directly:
apiVersion: actions.github.com/v1alpha1
kind: AutoscalingRunnerSet
metadata:
  annotations: # abbreviated
  labels: # abbreviated
  name: example-gha-runner-scale-set
spec:
  githubConfigSecret: "<some_value>"
  githubConfigUrl: "<some_value>"
  maxRunners: 2
  minRunners: 1
  scheduledOverrides:
  - startTime: "2021-05-01T00:00:00+09:00"
    endTime: "2021-05-03T00:00:00+09:00"
    recurrenceRule:
      frequency: Weekly
      untilTime: "2024-07-01T00:00:00+09:00"
    minRunners: 0
  1. With the gha-runner-scale-set helm chart, by setting scheduledOverrides in the values:
minRunners: 1
maxRunners: 2

scheduledOverrides:
  - startTime: "2021-05-01T00:00:00+09:00"
    endTime: "2021-05-03T00:00:00+09:00"
    recurrenceRule:
      frequency: Weekly
      untilTime: "2024-07-01T00:00:00+09:00"
    minRunners: 0

Notable changes

Changes to the AutoscalingRunnerSet Status

  1. Like the previous implementation of scheduled overrides, this PR introduces the ScheduledOverridesSummary field in the AutoscalingRunnerSet Status.

  2. In order to share the desired minimum runners between the AutoscalingRunnerSet and AutoscalingListener resources post scheduled overrides evaluation, an additional field is introduced to the AutoscalingRunnerSet Status - DesiredMinRunners. Whenever the listener's minRunners value is different than DesiredMinRunners, the listener is deleted so it can be recreated.

Changes to requeuing of requests

In order to reevaluate the scheduled overrides, the final return ctrl.Result{}, nil in the autoscalingrunnerset reconciliation function was changed to requeue the request after 1 minute.

asafhm avatar Jun 02 '24 21:06 asafhm