Stop creating registration-only runners on scale-to-zero (#1028)

Resolves #859
This commit is contained in:
Yusuke Kuoka
2022-01-07 09:56:21 +09:00
committed by GitHub
parent 02679ac1d8
commit 01301d3ce8
4 changed files with 19 additions and 67 deletions
@@ -2,7 +2,6 @@ package controllers
import (
"context"
"fmt"
"math/rand"
"net/http/httptest"
"time"
@@ -257,22 +256,6 @@ var _ = Context("Inside of a new namespace", func() {
})
Expect(err).ToNot(HaveOccurred())
var regOnly actionsv1alpha1.Runner
if err := k8sClient.Get(ctx, types.NamespacedName{Namespace: ns.Name, Name: registrationOnlyRunnerNameFor(name)}, &regOnly); err != nil {
logf.Log.Info(fmt.Sprintf("Failed getting registration-only runner in test: %v", err))
return -1
} else {
updated := regOnly.DeepCopy()
updated.Status.Phase = "Completed"
if err := k8sClient.Status().Patch(ctx, updated, client.MergeFrom(&regOnly)); err != nil {
logf.Log.Info(fmt.Sprintf("Failed updating registration-only runner in test: %v", err))
return -1
}
runnersList.AddOffline([]actionsv1alpha1.Runner{*updated})
}
if err := k8sClient.List(ctx, &runners, client.InNamespace(ns.Name), client.MatchingLabelsSelector{Selector: selector}); err != nil {
logf.Log.Error(err, "list runners")
return -1