From a36b0e58b01162b6aeb0d5f1cd3a75d82d3513ac Mon Sep 17 00:00:00 2001 From: Juliet Boyd <5061312+julietrb1@users.noreply.github.com> Date: Wed, 9 Aug 2023 18:53:39 +1000 Subject: [PATCH] Clarify multiple metrics in docs (#2712) Co-authored-by: Dylan Boyd <5061312+dylanjboyd@users.noreply.github.com> --- docs/automatically-scaling-runners.md | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/automatically-scaling-runners.md b/docs/automatically-scaling-runners.md index 4d7dc8fd..054e6376 100644 --- a/docs/automatically-scaling-runners.md +++ b/docs/automatically-scaling-runners.md @@ -186,6 +186,38 @@ spec: scaleDownAdjustment: 1 # The scale down runner count subtracted from the desired count ``` +**Combining Pull Driven Scaling Metrics** + +If a HorizontalRunnerAutoscaler is configured with a secondary metric of `TotalNumberOfQueuedAndInProgressWorkflowRuns`, then be aware that the controller will check the primary metric of `PercentageRunnersBusy` first and will only use the secondary metric to calculate the desired replica count if the primary metric returns 0 desired replicas. + +`PercentageRunnersBusy` metrics must appear before `TotalNumberOfQueuedAndInProgressWorkflowRuns`; otherwise, the controller will fail to process the `HorizontalRunnerAutoscaler`. A valid configuration follows. + +```yaml +--- +apiVersion: actions.summerwind.dev/v1alpha1 +kind: HorizontalRunnerAutoscaler +metadata: + name: example-runner-deployment-autoscaler +spec: + scaleTargetRef: + kind: RunnerDeployment + # # In case the scale target is RunnerSet: + # kind: RunnerSet + name: example-runner-deployment + minReplicas: 1 + maxReplicas: 5 + metrics: + - type: PercentageRunnersBusy + scaleUpThreshold: '0.75' # The percentage of busy runners at which the number of desired runners are re-evaluated to scale up + scaleDownThreshold: '0.3' # The percentage of busy runners at which the number of desired runners are re-evaluated to scale down + scaleUpAdjustment: 2 # The scale up runner count added to desired count + scaleDownAdjustment: 1 # The scale down runner count subtracted from the desired count + - type: TotalNumberOfQueuedAndInProgressWorkflowRuns + repositoryNames: + # A repository name is the REPO part of `github.com/OWNER/REPO` + - myrepo +``` + ## Webhook Driven Scaling > This feature requires controller version => [v0.20.0](https://github.com/actions/actions-runner-controller/releases/tag/v0.20.0) @@ -431,8 +463,6 @@ The main use case for scaling from 0 is with the `HorizontalRunnerAutoscaler` ki `PercentageRunnersBusy` can't be used alone for scale-from-zero as, by its definition, it needs one or more GitHub runners to become `busy` to be able to scale. If there isn't a runner to pick up a job and enter a `busy` state then the controller will never know to provision a runner to begin with as this metric has no knowledge of the job queue and is relying on using the number of busy runners as a means for calculating the desired replica count. -If a HorizontalRunnerAutoscaler is configured with a secondary metric of `TotalNumberOfQueuedAndInProgressWorkflowRuns` then be aware that the controller will check the primary metric of `PercentageRunnersBusy` first and will only use the secondary metric to calculate the desired replica count if the primary metric returns 0 desired replicas. - Webhook-based autoscaling is the best option as it is relatively easy to configure and also it can scale quickly. ## Scheduled Overrides