Use ActionableRevision and observed generation to track update propagation#4575
Open
nikola-jokic wants to merge 24 commits into
Open
Use ActionableRevision and observed generation to track update propagation#4575nikola-jokic wants to merge 24 commits into
nikola-jokic wants to merge 24 commits into
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…hemeralRunnerSet and AutoscalingRunnerSet
…hemeralRunnerSet and AutoscalingRunnerSet
nikola-jokic
requested review from
Steve-Glass,
mumoshu,
rentziass and
toast-gear
as code owners
July 20, 2026 12:09
nikola-jokic
changed the base branch from
nikola-jokic/improve-perf-foundation
to
master
July 20, 2026 12:11
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous “integrity-hash mismatch” update-detection approach with (a) a new in-memory ResourceCache intended to reduce allocations during desired-object construction and (b) restart-safe status markers (ActionableRevision / AppliedActionableRevision and ObservedGeneration) to track update propagation without recomputing hashes every reconcile.
Changes:
- Introduces a typed
ResourceCacheand wires it into controllerResourceBuilderusage. - Replaces spec-hash-based propagation with
EphemeralRunnerSet.Spec.ActionableRevision+Status.AppliedActionableRevision, and addsAutoscalingRunnerSet.Status.ObservedGeneration. - Updates CRDs/charts and expands controller/unit tests to cover the new propagation semantics and cache lifecycle.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| main.go | Instantiates a shared ResourceCache and injects it into the ResourceBuilder used by reconcilers. |
| controllers/actions.github.com/resourcecache.go | Adds the new in-memory cache implementation for desired resource objects. |
| controllers/actions.github.com/resourcecache_test.go | Adds unit tests for cache keying/invalidation and deletion behavior. |
| controllers/actions.github.com/resourcebuilder.go | Removes integrity-hash annotations and attempts to use ResourceCache to reuse built objects. |
| controllers/actions.github.com/resourcebuilder_test.go | Updates tests to initialize ResourceCache and removes integrity-hash assertions. |
| controllers/actions.github.com/helpers.go | Adds helper logic for actionable-spec detection, actionable revision incrementing, and pod canonical/spec comparison. |
| controllers/actions.github.com/helpers_test.go | Adds unit tests for the new helper functions. |
| controllers/actions.github.com/ephemeralrunnerset_controller.go | Switches spec-change detection to actionable revision and patches applied revision status after cleanup. |
| controllers/actions.github.com/ephemeralrunnerset_controller_test.go | Adds scenarios validating cleanup semantics and applied-revision advancement (including failure/restart cases). |
| controllers/actions.github.com/ephemeralrunner_controller.go | Adjusts cleanup flow and ensures cache entries are deleted on finalization paths. |
| controllers/actions.github.com/ephemeralrunner_controller_test.go | Updates tests to validate cache cleanup on runner deletion. |
| controllers/actions.github.com/autoscalingrunnerset_controller.go | Uses ObservedGeneration for pending detection and uses ActionableRevision when updating the ERS spec. |
| controllers/actions.github.com/autoscalingrunnerset_controller_test.go | Updates tests to validate observed generation and actionable revision increments and cache behavior. |
| controllers/actions.github.com/autoscalinglistener_controller.go | Removes integrity-hash-based pod recreation and shifts to spec derivative checks + annotation/label patching. |
| controllers/actions.github.com/autoscalinglistener_controller_test.go | Updates/extends tests around caching, pod recreation criteria, and metadata propagation expectations. |
| config/crd/bases/actions.github.com_ephemeralrunnersets.yaml | Adds actionableRevision (spec) and appliedActionableRevision (status) to the ERS CRD schema. |
| config/crd/bases/actions.github.com_autoscalingrunnersets.yaml | Adds observedGeneration to the ARS CRD schema. |
| charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml | Mirrors ERS CRD schema changes in the Helm chart CRDs. |
| charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml | Mirrors ARS CRD schema changes in the Helm chart CRDs. |
| charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_ephemeralrunnersets.yaml | Mirrors ERS CRD schema changes in the experimental chart CRDs. |
| charts/gha-runner-scale-set-controller-experimental/crds/actions.github.com_autoscalingrunnersets.yaml | Mirrors ARS CRD schema changes in the experimental chart CRDs. |
| apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go | Adds ActionableRevision to spec and AppliedActionableRevision to status. |
| apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go | Adds ObservedGeneration to status. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+129
to
+133
| ImagePullSecrets: imagePullSecrets, | ||
| }) | ||
| if cached, ok := b.ResourceCache.autoscalingListener.Get(autoscalingRunnerSet, cacheKeyObject, ephemeralRunnerSet, inputDependency); ok { | ||
| return cached, nil | ||
| } |
Comment on lines
+329
to
+333
| }, | ||
| } | ||
| if cached, ok := b.ResourceCache.listenerPod.Get(autoscalingListener, cacheKeyObject, podConfig, serviceAccount, role, roleBinding); ok { | ||
| return cached, nil | ||
| } |
Comment on lines
+730
to
+734
| }, | ||
| } | ||
| if cached, ok := b.ResourceCache.ephemeralRunnerSet.Get(autoscalingRunnerSet, cacheKeyObject); ok { | ||
| return cached, nil | ||
| } |
nikola-jokic
force-pushed
the
nikola-jokic/remove-annotation-fingerprint
branch
from
July 21, 2026 14:25
0ce130d to
36d8aae
Compare
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.
Previously the controllers knew about the update when the spec hash contained a mismatch. It caused unnecessary hash calculations on each reconciliation loop.
This change aims to use 2 fields, 1 is the spec field containing the actual desired actionable revision, while the status field helps us know if the state has been reached.
It reduces the unnecessary allocations as well as hash computation.
Based on #4568