From 38644cf4e8024e151e9452d92d79e5b3c852caea Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Fri, 15 Jul 2022 09:58:30 +0900 Subject: [PATCH] Remove redundant flags from webhook-based autoscaler (#1630) * Remove redundant flags from webhook-based autoscaler Ref #623 * fixup! Remove redundant flags from webhook-based autoscaler --- charts/actions-runner-controller/README.md | 1 - .../templates/githubwebhook.deployment.yaml | 1 - charts/actions-runner-controller/values.yaml | 1 - cmd/githubwebhookserver/main.go | 11 +++-------- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/charts/actions-runner-controller/README.md b/charts/actions-runner-controller/README.md index 7d5a776e..9861c917 100644 --- a/charts/actions-runner-controller/README.md +++ b/charts/actions-runner-controller/README.md @@ -78,7 +78,6 @@ All additional docs are kept in the `docs/` folder, this README is solely for do | `githubWebhookServer.logLevel` | Set the log level of the githubWebhookServer container | | | `githubWebhookServer.replicaCount` | Set the number of webhook server pods | 1 | | `githubWebhookServer.useRunnerGroupsVisibility` | Enable supporting runner groups with custom visibility. This will incur in extra API calls and may blow up your budget. Currently, you also need to set `githubWebhookServer.secret.enabled` to enable this feature. | false | -| `githubWebhookServer.syncPeriod` | Set the period in which the controller reconciles the resources | 10m | | `githubWebhookServer.enabled` | Deploy the webhook server pod | false | | `githubWebhookServer.secret.enabled` | Passes the webhook hook secret to the github-webhook-server | false | | `githubWebhookServer.secret.create` | Deploy the webhook hook secret | false | diff --git a/charts/actions-runner-controller/templates/githubwebhook.deployment.yaml b/charts/actions-runner-controller/templates/githubwebhook.deployment.yaml index fd05a181..e7121b8a 100644 --- a/charts/actions-runner-controller/templates/githubwebhook.deployment.yaml +++ b/charts/actions-runner-controller/templates/githubwebhook.deployment.yaml @@ -39,7 +39,6 @@ spec: {{- $metricsHost := .Values.metrics.proxy.enabled | ternary "127.0.0.1" "0.0.0.0" }} {{- $metricsPort := .Values.metrics.proxy.enabled | ternary "8080" .Values.metrics.port }} - "--metrics-addr={{ $metricsHost }}:{{ $metricsPort }}" - - "--sync-period={{ .Values.githubWebhookServer.syncPeriod }}" {{- if .Values.githubWebhookServer.logLevel }} - "--log-level={{ .Values.githubWebhookServer.logLevel }}" {{- end }} diff --git a/charts/actions-runner-controller/values.yaml b/charts/actions-runner-controller/values.yaml index 0323f501..48588b7e 100644 --- a/charts/actions-runner-controller/values.yaml +++ b/charts/actions-runner-controller/values.yaml @@ -192,7 +192,6 @@ admissionWebHooks: githubWebhookServer: enabled: false replicaCount: 1 - syncPeriod: 10m useRunnerGroupsVisibility: false secret: enabled: false diff --git a/cmd/githubwebhookserver/main.go b/cmd/githubwebhookserver/main.go index 05c90ac3..794f9361 100644 --- a/cmd/githubwebhookserver/main.go +++ b/cmd/githubwebhookserver/main.go @@ -69,10 +69,8 @@ func main() { watchNamespace string - enableLeaderElection bool - syncPeriod time.Duration - logLevel string - queueLimit int + logLevel string + queueLimit int ghClient *github.Client ) @@ -89,9 +87,6 @@ func main() { flag.StringVar(&webhookAddr, "webhook-addr", ":8000", "The address the metric endpoint binds to.") flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&watchNamespace, "watch-namespace", "", "The namespace to watch for HorizontalRunnerAutoscaler's to scale on Webhook. Set to empty for letting it watch for all namespaces.") - flag.BoolVar(&enableLeaderElection, "enable-leader-election", false, - "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.") - flag.DurationVar(&syncPeriod, "sync-period", 10*time.Minute, "Determines the minimum frequency at which K8s resources managed by this controller are reconciled. When you use autoscaling, set to a lower value like 10 minute, because this corresponds to the minimum time to react on demand change") flag.StringVar(&logLevel, "log-level", logging.LogLevelDebug, `The verbosity of the logging. Valid values are "debug", "info", "warn", "error". Defaults to "debug".`) flag.IntVar(&queueLimit, "queue-limit", controllers.DefaultQueueLimit, `The maximum length of the scale operation queue. The scale opration is enqueued per every matching webhook event, and the server returns a 500 HTTP status when the queue was already full on enqueue attempt.`) flag.StringVar(&webhookSecretToken, "github-webhook-secret-token", "", "The personal access token of GitHub.") @@ -144,10 +139,10 @@ func main() { setupLog.Info("GitHub client is not initialized. Runner groups with custom visibility are not supported. If needed, please provide GitHub authentication. This will incur in extra GitHub API calls") } + syncPeriod := 10 * time.Minute mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, SyncPeriod: &syncPeriod, - LeaderElection: enableLeaderElection, Namespace: watchNamespace, MetricsBindAddress: metricsAddr, Port: 9443,