mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-09-30 18:06:52 +02:00
Make the Outdated phase revision-aware
An outdated runner used to flip the whole scale set into the Outdated
phase permanently, which tears down the listener and switches the scale
set off. That verdict outlived the runner spec it was about: a runner
busy with a job survives the revision cleanup that follows a spec
update, and only reports Outdated once the job finishes. The result was
that a freshly applied fix could be discarded by a runner that never ran
it.
Runners are now stamped with the actionable revision they were built
from. An Outdated runner whose revision is behind the applied revision is
considered stale: it is deleted so the scaling logic replaces it with one
built from the current spec, and it no longer contributes to the set's
phase. A runner at the current revision still marks the set Outdated, so
a genuinely bad spec is still surfaced.
Two supporting fixes:
- patchAppliedActionableRevisionStatus now recomputes the phase in both
directions. It only ever forced Running, so the early-return path
could leave a stale Outdated behind.
- The AutoscalingRunnerSet only tears down on an Outdated set once that
set has applied its current actionable revision. Otherwise a spec
update races the EphemeralRunnerSet controller and the teardown fires
against a phase that predates the update.
Runners created before this change parse to revision 0, which matches
the zero value of AppliedActionableRevision, so they are treated as
current until a revision is actually applied.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot App
parent
2aef0aeedd
commit
41d05325c2
@@ -39,6 +39,30 @@ func nextActionableRevision(current *v1alpha1.EphemeralRunnerSet) int64 {
|
||||
return current.Status.AppliedActionableRevision + 1
|
||||
}
|
||||
|
||||
// ephemeralRunnerSetOutdatedForAppliedRevision reports whether the set is
|
||||
// Outdated *because of the runner spec it is currently running*, which is the
|
||||
// only situation in which the AutoscalingRunnerSet should tear the scale set
|
||||
// down.
|
||||
//
|
||||
// The phase alone is not enough. Outdated is deliberately sticky: it survives in
|
||||
// status while the outdated runners are collected, and it is only cleared once a
|
||||
// new revision is applied. So between the moment the AutoscalingRunnerSet patches
|
||||
// a new runner spec onto the set and the moment the EphemeralRunnerSet controller
|
||||
// processes that patch, the set still reports Outdated for a spec that no longer
|
||||
// exists. Tearing down there would discard the fix the user just applied, and the
|
||||
// scale set would stay switched off until something else nudged it.
|
||||
//
|
||||
// Requiring the applied revision to have caught up with the spec revision closes
|
||||
// that window: the verdict counts only once the set is running the current spec.
|
||||
func ephemeralRunnerSetOutdatedForAppliedRevision(ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet) bool {
|
||||
if ephemeralRunnerSet == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return ephemeralRunnerSet.Status.Phase == v1alpha1.EphemeralRunnerSetPhaseOutdated &&
|
||||
ephemeralRunnerSet.Status.AppliedActionableRevision >= ephemeralRunnerSet.Spec.ActionableRevision
|
||||
}
|
||||
|
||||
// listenerPodSpecRequiresRecreation reports whether the live listener pod must be
|
||||
// deleted and rebuilt to match the desired spec.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user