Repository navigation
Conversation
Wait for cached child lists to observe successful creates and deletes before scaling or cleaning up a runner set. Track generated runner names per owner UID, observe deletion timestamps without waiting for finalizers, and expire missing observations after five minutes. Continue safe status and proxy-secret reconciliation while waiting, and requeue to recover from lost watch events. Add deterministic lagging-cache regressions and tests for expectation lifetime, failed writes, ownership changes, and cleanup gating.
jia-pylon
requested review from
a team,
Steve-Glass,
mumoshu,
nikola-jokic,
rentziass and
toast-gear
as code owners
November 4, 2026 23:22
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4734
What
The EphemeralRunnerSet controller now remembers the runners it has created or deleted until its informer cache shows them. Before that happens, it does not make another scale or cleanup decision for that set. This is the controller-expectations pattern from kube-controller-manager's ReplicaSet controller, scaled down to what ARC needs.
runnerExpectations(new,runner_expectations.go) is a small, mutex-protected type keyed by the set's namespace/name and owner UID. It records the server-generated name of each successful create, and the name of each successful delete (or a NotFound / already-terminating result).resourceOwnerKeylist. That list is checked against the recorded names: a create counts as seen once its name appears, and a delete once its name is gone or has adeletionTimestamp. A set does not wait for runner finalizers, and terminating runners still block scale-up through the existingdeletingcount.Why
See #4734. A reconcile woken by the controller's own status patch, or by the first child's add event, can count too few runners and create a second batch. In unmodified envtest runs on master this happened in 21 of 24 full-suite runs (kube-apiserver 1.35/1.36/1.37), e.g. 9 runners created for
replicas: 5before scale-down removed the extras.I also considered listing children through
APIReaderon every reconcile. It fixes the race, but it reads every EphemeralRunner in the namespace on every child event, whichpatchAppliedActionableRevisionStatusalready notes is only acceptable on rare paths.Tests
ephemeralrunnerset_cache_lag_test.go: deterministic regressions with a client whoseListomits recent writes. They cover scale-up, scale-up blocked behind deletes, scale-down, and filtering by ownership. On master they fail (4 runners forreplicas: 2, plus surplus deletes) and with this change they pass.runner_expectations_test.go: observation, delete observation by absence and bydeletionTimestamp, TTL expiry, UID change, concurrent owners, failed writes not recorded.ephemeralrunnerset_expectations_test.go: cleanup and finalization are gated, no authoritative list is needed, and state is cleared after deletion.autoscalingrunnerset_cache_lag_test.go: pins that a repeated EphemeralRunnerSet create from the AutoscalingRunnerSet controller is rejected by its fixed name, so that path needs no expectations.Full
controllers/actions.github.comsuite, 10 runs per kube-apiserver version with this change:go build ./...andgo vet ./controllers/...are clean.golangci-lintreports the same five findings as master and no new ones.