Keep the outdated phase until the runner spec itself changes (#4660)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Nikola Jokic
2026-09-17 17:03:21 +02:00
committed by GitHub
co-authored by Copilot App Copilot Autofix powered by AI
parent be44bb58cf
commit dc12c2d417
17 changed files with 1776 additions and 135 deletions
+31
View File
@@ -39,6 +39,15 @@ func SetupIndexers(mgr ctrl.Manager) error {
return err
}
if err := mgr.GetFieldIndexer().IndexField(
context.Background(),
&v1alpha1.AutoscalingListener{},
autoscalingRunnerSetOwnerKey,
autoscalingListenerRunnerSetIndexer,
); err != nil {
return err
}
if err := mgr.GetFieldIndexer().IndexField(
context.Background(),
&v1alpha1.EphemeralRunner{},
@@ -51,6 +60,28 @@ func SetupIndexers(mgr ctrl.Manager) error {
return nil
}
// autoscalingListenerRunnerSetIndexer indexes a listener by the scale set its
// spec points back at, so the listeners belonging to a scale set can be found
// without deriving their names. The derived name is a hash over the runner group
// and the config URL, both of which a user may edit, so a name is only ever the
// right lookup for the listener a scale set wants *now* - never for the ones it
// already has.
func autoscalingListenerRunnerSetIndexer(o client.Object) []string {
listener, ok := o.(*v1alpha1.AutoscalingListener)
if !ok {
return nil
}
return []string{autoscalingRunnerSetOwnerIndexValue(
listener.Spec.AutoscalingRunnerSetNamespace,
listener.Spec.AutoscalingRunnerSetName,
)}
}
func autoscalingRunnerSetOwnerIndexValue(namespace, name string) string {
return namespace + "/" + name
}
func newGroupVersionOwnerKindIndexer(ownerKind string, otherOwnerKinds ...string) client.IndexerFunc {
owners := append([]string{ownerKind}, otherOwnerKinds...)
return func(o client.Object) []string {