From 8071ac7066694e7e5253e9143fe188578f9c4e0f Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Tue, 12 Jul 2022 20:37:24 +0900 Subject: [PATCH] Remove github-api-cache-duration flag and code (#1631) This removes the flag and code for the legacy GitHub API cache. We already migrated to fully use the new HTTP cache based API cache functionality which had been added via #1127 and available since ARC 0.22.0. Since then, the legacy one had been no-op and therefore removing it is safe. Ref #1412 --- .../templates/deployment.yaml | 3 --- charts/actions-runner-controller/values.yaml | 6 ------ .../horizontalrunnerautoscaler_controller.go | 1 - controllers/integration_test.go | 13 ++++++------- main.go | 13 +------------ 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/charts/actions-runner-controller/templates/deployment.yaml b/charts/actions-runner-controller/templates/deployment.yaml index 60e4e856..55a9f601 100644 --- a/charts/actions-runner-controller/templates/deployment.yaml +++ b/charts/actions-runner-controller/templates/deployment.yaml @@ -58,9 +58,6 @@ spec: {{- if .Values.scope.singleNamespace }} - "--watch-namespace={{ default .Release.Namespace .Values.scope.watchNamespace }}" {{- end }} - {{- if .Values.githubAPICacheDuration }} - - "--github-api-cache-duration={{ .Values.githubAPICacheDuration }}" - {{- end }} {{- if .Values.logLevel }} - "--log-level={{ .Values.logLevel }}" {{- end }} diff --git a/charts/actions-runner-controller/values.yaml b/charts/actions-runner-controller/values.yaml index 0ce81128..d3083d5f 100644 --- a/charts/actions-runner-controller/values.yaml +++ b/charts/actions-runner-controller/values.yaml @@ -15,12 +15,6 @@ enableLeaderElection: true # Must be unique if more than one controller installed onto the same namespace. #leaderElectionId: "actions-runner-controller" -# DEPRECATED: This has been removed as unnecessary in #1192 -# The controller tries its best not to repeat the duplicate GitHub API call -# within this duration. -# Defaults to syncPeriod - 10s. -#githubAPICacheDuration: 30s - # The URL of your GitHub Enterprise server, if you're using one. #githubEnterpriseServerURL: https://github.example.com diff --git a/controllers/horizontalrunnerautoscaler_controller.go b/controllers/horizontalrunnerautoscaler_controller.go index 760d914b..1430e5f8 100644 --- a/controllers/horizontalrunnerautoscaler_controller.go +++ b/controllers/horizontalrunnerautoscaler_controller.go @@ -51,7 +51,6 @@ type HorizontalRunnerAutoscalerReconciler struct { Log logr.Logger Recorder record.EventRecorder Scheme *runtime.Scheme - CacheDuration time.Duration DefaultScaleDownDelay time.Duration Name string } diff --git a/controllers/integration_test.go b/controllers/integration_test.go index cf2ecfb4..730a62e4 100644 --- a/controllers/integration_test.go +++ b/controllers/integration_test.go @@ -138,13 +138,12 @@ func SetupIntegrationTest(ctx2 context.Context) *testEnvironment { Expect(err).NotTo(HaveOccurred(), "failed to setup runnerdeployment controller") autoscalerController := &HorizontalRunnerAutoscalerReconciler{ - Client: mgr.GetClient(), - Scheme: scheme.Scheme, - Log: logf.Log, - GitHubClient: multiClient, - Recorder: mgr.GetEventRecorderFor("horizontalrunnerautoscaler-controller"), - CacheDuration: 1 * time.Second, - Name: controllerName("horizontalrunnerautoscaler"), + Client: mgr.GetClient(), + Scheme: scheme.Scheme, + Log: logf.Log, + GitHubClient: multiClient, + Recorder: mgr.GetEventRecorderFor("horizontalrunnerautoscaler-controller"), + Name: controllerName("horizontalrunnerautoscaler"), } err = autoscalerController.SetupWithManager(mgr) Expect(err).NotTo(HaveOccurred(), "failed to setup autoscaler controller") diff --git a/main.go b/main.go index 63e3a22a..f15e09c5 100644 --- a/main.go +++ b/main.go @@ -75,8 +75,7 @@ func main() { port int syncPeriod time.Duration - gitHubAPICacheDuration time.Duration - defaultScaleDownDelay time.Duration + defaultScaleDownDelay time.Duration runnerImage string runnerImagePullSecrets stringSlice @@ -114,7 +113,6 @@ func main() { flag.StringVar(&c.BasicauthPassword, "github-basicauth-password", c.BasicauthPassword, "Password for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API") flag.StringVar(&c.RunnerGitHubURL, "runner-github-url", c.RunnerGitHubURL, "GitHub URL to be used by runners during registration") flag.BoolVar(&runnerStatusUpdateHook, "runner-status-update-hook", false, "Use custom RBAC for runners (role, role binding and service account).") - flag.DurationVar(&gitHubAPICacheDuration, "github-api-cache-duration", 0, "DEPRECATED: The duration until the GitHub API cache expires. Setting this to e.g. 10m results in the controller tries its best not to make the same API call within 10m to reduce the chance of being rate-limited. Defaults to mostly the same value as sync-period. If you're tweaking this in order to make autoscaling more responsive, you'll probably want to tweak sync-period, too") flag.DurationVar(&defaultScaleDownDelay, "default-scale-down-delay", controllers.DefaultScaleDownDelay, "The approximate delay for a scale down followed by a scale up, used to prevent flapping (down->up->down->... loop)") flag.IntVar(&port, "port", 9443, "The port to which the admission webhook endpoint should bind") flag.DurationVar(&syncPeriod, "sync-period", 1*time.Minute, "Determines the minimum frequency at which K8s resources managed by this controller are reconciled.") @@ -213,17 +211,9 @@ func main() { log.Error(err, "unable to create controller", "controller", "RunnerSet") os.Exit(1) } - if gitHubAPICacheDuration == 0 { - gitHubAPICacheDuration = syncPeriod - 10*time.Second - } - - if gitHubAPICacheDuration < 0 { - gitHubAPICacheDuration = 0 - } log.Info( "Initializing actions-runner-controller", - "github-api-cache-duration", gitHubAPICacheDuration, "default-scale-down-delay", defaultScaleDownDelay, "sync-period", syncPeriod, "default-runner-image", runnerImage, @@ -239,7 +229,6 @@ func main() { Log: log.WithName("horizontalrunnerautoscaler"), Scheme: mgr.GetScheme(), GitHubClient: multiClient, - CacheDuration: gitHubAPICacheDuration, DefaultScaleDownDelay: defaultScaleDownDelay, }