Skip to content

Use ActionableRevision and observed generation to track update propagation#4575

Open
nikola-jokic wants to merge 24 commits into
masterfrom
nikola-jokic/remove-annotation-fingerprint
Open

Use ActionableRevision and observed generation to track update propagation#4575
nikola-jokic wants to merge 24 commits into
masterfrom
nikola-jokic/remove-annotation-fingerprint

Conversation

@nikola-jokic

Copy link
Copy Markdown
Collaborator

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

@nikola-jokic
nikola-jokic changed the base branch from nikola-jokic/improve-perf-foundation to master July 20, 2026 12:11
Copilot AI review requested due to automatic review settings July 21, 2026 09:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ResourceCache and wires it into controller ResourceBuilder usage.
  • Replaces spec-hash-based propagation with EphemeralRunnerSet.Spec.ActionableRevision + Status.AppliedActionableRevision, and adds AutoscalingRunnerSet.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
}
Comment thread controllers/actions.github.com/resourcecache.go
Comment thread controllers/actions.github.com/autoscalinglistener_controller.go Outdated
Comment thread controllers/actions.github.com/autoscalinglistener_controller.go
@nikola-jokic
nikola-jokic force-pushed the nikola-jokic/remove-annotation-fingerprint branch from 0ce130d to 36d8aae Compare July 21, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants