Introduce cache for lookups of desired resource state, to reduce the amount of allocations in the controller (#4568)

This commit is contained in:
Nikola Jokic
2026-09-07 13:49:28 +02:00
committed by GitHub
parent 87592be6d3
commit 54147cfa5e
13 changed files with 860 additions and 26 deletions
@@ -109,6 +109,7 @@ func (r *AutoscalingRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl
}
log.Info("Successfully removed finalizer after cleanup")
r.ResourceCache.Delete(&autoscalingRunnerSet)
return ctrl.Result{}, nil
}
@@ -763,6 +764,7 @@ func (r *AutoscalingRunnerSetReconciler) deleteRunnerScaleSet(ctx context.Contex
}
func (r *AutoscalingRunnerSetReconciler) createEphemeralRunnerSet(ctx context.Context, autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet, log logr.Logger) (ctrl.Result, error) {
r.ResourceCache.ephemeralRunnerSet.Delete(autoscalingRunnerSet)
desiredRunnerSet, err := r.newEphemeralRunnerSet(autoscalingRunnerSet)
if err != nil {
log.Error(err, "Could not create EphemeralRunnerSet")
@@ -787,6 +789,7 @@ func (r *AutoscalingRunnerSetReconciler) createAutoScalingListenerForRunnerSet(c
})
}
r.ResourceCache.autoscalingListener.Delete(autoscalingRunnerSet)
autoscalingListener, err := r.newAutoscalingListener(
autoscalingRunnerSet,
ephemeralRunnerSet,