Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion controllers/githubactionrunner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"strings"
"time"

env "github.com/caitlinelfring/go-env-default"

garov1alpha1 "github.com/evryfs/github-actions-runner-operator/api/v1alpha1"
"github.com/evryfs/github-actions-runner-operator/controllers/githubapi"
"github.com/go-logr/logr"
Expand All @@ -47,6 +49,7 @@ const finalizer = "garo.tietoevry.com/runner-registration"
const registrationTokenKey = "RUNNER_TOKEN"
const registrationTokenExpiresAtAnnotation = "garo.tietoevry.com/expiryTimestamp"
const regTokenPostfix = "regtoken"
const deleteEvictedPodsEnvVarName = "GARO_DELETE_EVICED_PODS"

// GithubActionRunnerReconciler reconciles a GithubActionRunner object
type GithubActionRunnerReconciler struct {
Expand Down Expand Up @@ -364,7 +367,7 @@ func (r *GithubActionRunnerReconciler) handleFinalization(ctx context.Context, c
if err := r.unregisterRunner(ctx, cr, item); err != nil {
return err
}
if isEvicted(&item.pod) {
if isEvicted(&item.pod) && env.GetBoolDefault(deleteEvictedPodsEnvVarName, true) {
logr.FromContextOrDiscard(ctx).Info("Deleting evicted pod", "podname", item.pod.Name)
err := r.DeleteResourceIfExists(ctx, &item.pod)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions controllers/githubapi/runnerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/palantir/go-githubapp/githubapp"
)

//IRunnerAPI is a service towards GitHubs runners
// IRunnerAPI is a service towards GitHubs runners
type IRunnerAPI interface {
GetRunners(ctx context.Context, organization string, repository string, token string) ([]*github.Runner, error)
UnregisterRunner(ctx context.Context, organization string, repository string, token string, runnerID int64) error
Expand All @@ -18,7 +18,7 @@ type runnerAPI struct {
clientCreator githubapp.ClientCreator
}

//NewRunnerAPI gets a new instance of the API.
// NewRunnerAPI gets a new instance of the API.
func NewRunnerAPI() (runnerAPI, error) {
config := githubapp.Config{
V3APIURL: "https://api.github.com",
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/evryfs/github-actions-runner-operator
go 1.19

require (
github.com/caitlinelfring/go-env-default v1.1.0
github.com/go-logr/logr v1.2.3
github.com/google/go-github/v45 v45.2.0
github.com/gophercloud/gophercloud v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqO
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/bradleyfalzon/ghinstallation/v2 v2.1.0 h1:5+NghM1Zred9Z078QEZtm28G/kfDfZN/92gkDlLwGVA=
github.com/bradleyfalzon/ghinstallation/v2 v2.1.0/go.mod h1:Xg3xPRN5Mcq6GDqeUVhFbjEWMb4JHCyWEeeBGEYQoTU=
github.com/caitlinelfring/go-env-default v1.1.0 h1:bhDfXmUolvcIGfQCX8qevQX8wxC54NGz0aimoUnhvDM=
github.com/caitlinelfring/go-env-default v1.1.0/go.mod h1:tESXPr8zFPP/cRy3cwxrHBmjJIf2A1x/o4C9CET2rEk=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
Expand Down