Switch the scale set off instead of rebuilding it when runners are outdated (#4652)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Nikola Jokic
2026-09-15 16:23:37 +02:00
committed by GitHub
co-authored by Copilot App
parent e425370456
commit b9eaf560f8
7 changed files with 586 additions and 84 deletions
+20
View File
@@ -1,11 +1,31 @@
package actionsgithubcom
import (
"strconv"
"github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1"
corev1 "k8s.io/api/core/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
)
func ephemeralRunnerSetNeedsOutdatedRecovery(ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet, autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) bool {
if ephemeralRunnerSet == nil || autoscalingRunnerSet == nil ||
autoscalingRunnerSet.Generation <= autoscalingRunnerSet.Status.ObservedGeneration {
return false
}
publishedGeneration, err := strconv.ParseInt(
ephemeralRunnerSet.Annotations[AnnotationKeyAutoscalingRunnerSetGeneration],
10,
64,
)
if err != nil {
return true
}
return publishedGeneration < autoscalingRunnerSet.Generation
}
// ephemeralRunnerSetActionableSpecChanged reports whether the runner spec the
// EphemeralRunnerSet is running differs from the one derived from the
// AutoscalingRunnerSet, in a way that requires re-applying it to the runners.