Fix scale-from-zero to retain the reg-only runner until other pods come up (#523)

Fixes #516
This commit is contained in:
Yusuke Kuoka
2021-05-05 12:13:51 +09:00
committed by GitHub
parent cb54864387
commit e7020c7c0f
3 changed files with 85 additions and 96 deletions

View File

@@ -2,11 +2,12 @@ package fake
import (
"encoding/json"
"github.com/summerwind/actions-runner-controller/api/v1alpha1"
"net/http"
"net/http/httptest"
"strconv"
"github.com/summerwind/actions-runner-controller/api/v1alpha1"
"github.com/google/go-github/v33/github"
"github.com/gorilla/mux"
)
@@ -79,6 +80,18 @@ func (r *RunnersList) Sync(runners []v1alpha1.Runner) {
}
}
func (r *RunnersList) AddOffline(runners []v1alpha1.Runner) {
for i, want := range runners {
r.Add(&github.Runner{
ID: github.Int64(int64(1000 + i)),
Name: github.String(want.Name),
OS: github.String("linux"),
Status: github.String("offline"),
Busy: github.Bool(false),
})
}
}
func exists(runners []*github.Runner, runner *github.Runner) bool {
for _, r := range runners {
if *r.Name == *runner.Name {