-
Notifications
You must be signed in to change notification settings - Fork 1.4k
EphemeralRunners created through an AutoscalingRunnerSet do not have labels set in the GitHub.com API #4425
Description
Checks
- I've already read https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/troubleshooting-actions-runner-controller-errors and I'm sure my issue is not covered in the troubleshooting guide.
- I am using charts that are officially provided
Controller Version
ghcr.io/actions/gha-runner-scale-set-controller 0.14.0
Deployment Method
Helm
Checks
- This isn't a question or user support case (For Q&A and community support, go to Discussions).
- I've read the Changelog before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes
To Reproduce
See #4424.
Ensure that AutoscalingRunnerSet has the labels set:
$ kubectl get autoscalingrunnerset -n arc-runners -o json | jq .items[0].spec.runnerScaleSetLabels
[
"self-hosted",
"linux",
"arc-runner-set"
]
(I wish I could easily prove that running scale set has this set server side, but the API is not documented and the [scaleset client](https://github.com/actions/scaleset) does not have an obvious endpoint documented beyond [`_apis/runtime/runnerscalesets`](https://github.com/actions/scaleset/blob/ebedf0bbbf6245cf5b1ff3c8a1297a08e133caf8/client.go#L24) (however I have not managed to guess what the host is). It's there on the web.
Let an ephemeral runner be created -- it won't have labels. Apply to runners (for example like this, starting with 0th one, repeat as needed)
curl -X POST -d '{"labels":["arc-runner-set"]}' \
-H "Authorization: Bearer $(grep github_token: 03-pat.secrets.yaml | cut -d':' -f 2)" \
https://api.github.com/repos/PERSONUSER/REPONAME/actions/runners/$(curl \
-H "Authorization: Bearer $(grep github_token: 03-pat.secrets.yaml | cut -d':' -f 2)" \
https://api.github.com/repos/PERSONUSER/REPONAME/actions/runners | jq -r .runners[0].id)/labels
Run an action.
See the runner get nuked / recycled.
See a new runner get created again without labels.Describe the bug
Runners created with ARC do not seem to get any labels attached to them.
Discovered at the same time as #4424, which was more about "when you edit labels on the chart and therefore on set, they do not get applied to autoscaling runner set in the API". But, it turns out that applying the labels in AutoscalingRunnerSet is also not sufficient for the runners to get labels applied.
The output from the API doesn't even show default labels that are meant to be applied, and in the web UI, there is no OS mentioned etc.
This means that tricks to route to the "best" runner by enumerating the runners, filtering by label, availability and busi-ness (such as what https://github.com/mikehardy/runner-fallback-action does) don't work, as no runner has the appropriate label attached.
Describe the expected behavior
If an AutoscalingRunnerSet has labels applied (via chart's scaleSetLabels [sic] which populates the object's spec.runnerScaleSetLabels, or directly setting that property), it would likely be a sane operation to have the runner get those labels applied, either by ARC or by the API's backends themselves.
It would also be a good idea to have the EphemeralRunnerSet1 store the intended labels in a runnerSetLabels as a copy of runnerScaleSetLabels from the parent.
EphemeralRunnerSet should likely propagate them into an individual EphemeralRunner as runnerLabels, which should then be the actual ones to create the runner with the labels specified (defaulting to letting API decide what to do if the list of labels is not present, as opposed to being empty).
There's also the precedent in some Kubernetes objects of not putting it into a dedicated field in the CRD, but into annotations or labels with a well-defined prefix: see how Service objects pick up some important configuration for various loadbalancer implementations.
From what I can tell, the CRD for EphemeralRunner does not seem to include runner labels as a standalone field, so if you choose to allow overriding the labels per runner (which seems to be the API's intention), either approach would make sense.
Additional Context
not applicable, beyond `scaleSetLabels` [sic] has been populated correctlyController Logs
not applicableRunner Pod Logs
not applicableFootnotes
-
It might also, perhaps, make sense for
EphemeralRunnerSetto be the entity that causes the controller to create a runner set in the API, not sure. ↩