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

Autoscaling for an organization runner #158

Closed
jeffj254 opened this issue Nov 6, 2020 · 7 comments
Closed

Autoscaling for an organization runner #158

jeffj254 opened this issue Nov 6, 2020 · 7 comments
Labels

Comments

@jeffj254
Copy link

jeffj254 commented Nov 6, 2020

I'm experimenting with self-hosted runners on Kubernetes. I'm trying to setup an auto-scaled runner deployment for an entire org in GitHub. While I can specify the org in the RunnerDeployment config, it seems like I'm only able to have this deployment scale by listing specific repos in repositoryNames in the HorizontalRunnerAutoscaler to watch for the number of pending workflows. Is there any way to scale based on all workflows across an entire org?

It doesn't look like the Actions API currently has a "list runs for organization" endpoint, so maybe that answers my question, but I figured I'd ask in case I was missing something.

@Warashi
Copy link
Contributor

Warashi commented Nov 19, 2020

List organization repositories API can solve this issue?
https://developer.github.com/v3/repos/#list-organization-repositories

@ghost
Copy link

ghost commented Nov 25, 2020

@mumoshu
Copy link
Collaborator

mumoshu commented Mar 8, 2021

Thank you so much for your efforts on #213 @erikkn!
It took too much time wrapping my head around this issue.

TL;DR; I think we have a possible solution to this now. Try using PercentageRunnersBusy.

Today, we have two scaling strategies TotalNumberOfQueuedAndInProgressWorkflowRuns and PercentageRunnersBusy. The former required #213. The latter seems to work on any kind of runner.

The only known downside of PercentageRunnersBusy is that depending on the configuration it takes a bit more time to scale runners out on demand. The workaround is to tweak scaleUpThreshold and scaleUpFactor so that it becomes less chances to workflow runs occupy all the runners.

@stale
Copy link

stale bot commented May 7, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 7, 2021
@mumoshu
Copy link
Collaborator

mumoshu commented May 7, 2021

@Warashi BTW, the List Organizations API solves only part of the problem. You can definitely fix it to not force us to list all the repos under repositoryNames, but you still need to figure out which repository name the RunnerDeployment is supposed to be used. Otherwise the controller would end up scaling the RunnerDeployment on queue/in progress workflow runs in irrelevant repos (like you end up scaling selfhosted runners on runs queued on repos that uses only managed runners

@stale stale bot removed the stale label May 7, 2021
@stale
Copy link

stale bot commented Jun 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 6, 2021
@stale stale bot closed this as completed Jun 20, 2021
@ajitkumarnayak1976
Copy link

There are 2 ways to achieve Horizontal Autoclavability on Ephemeral Runner.

Pull Driven Scaling - The Scale in and out is based on Metrics attribute. The Metrics could be of TotalNumberOfQueuedAndInProgressWorkflowRuns or PercentageRunnersBusy
Webbook Driven Scaling - The webbook server receives GitHub Webbook events and scales RunnerDeployments by updating corresponding HorizontalRunnerAutoscalers. the Webhook server can be configured to respond to GitHub's check_run, workflow_job, pull_request, and push events by scaling up the matching HorizontalRunnerAutoscaler by N replica(s), where N is configurable within HorizontalRunnerAutoscaler's spec:. Webbooks are processed by a separate webhook server.

But what would be the best recommended approach and why ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants