From fe90f57a10f30cd5fcdfe6c35099cb41cae99db9 Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Tue, 17 Sep 2024 00:26:37 +0300 Subject: [PATCH] added flag for webhook port configuration (#1107) --- docs/CHANGELOG.md | 1 + internal/manager/manager.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d9694cd7..d333d3ea 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,6 +16,7 @@ aliases: - [operator](https://docs.victoriametrics.com/operator/): reduces reconcile latency. See this [commit](2a9d09d0131cc10a0f9e32f0e2e054687ada78f7) for details. - [operator](https://docs.victoriametrics.com/operator/): reduces load on kubernetes api-server. See this commits: [commit-0](a0145b8a89dd5bb9051f8d4359b6a70c1d1a95ce), [commit-1](e2fbbd3e37146670f656d700ad0f64b2c299b0a0), [commit-2](184ba19a5f1d10dc2ac1bf018b2729f64e2a8c25). - [operator](https://docs.victoriametrics.com/operator/): enables client cache back for `secrets` and `configmaps`. Adds new flag `-controller.disableCacheFor=seccret,configmap` to disable it if needed. +- [operator](https://docs.victoriametrics.com/operator/): made webhook port configurable. See [this issue](https://github.com/VictoriaMetrics/operator/issues/1106) for details. ## [v0.47.3](https://github.com/VictoriaMetrics/operator/releases/tag/v0.47.3) - 28 Aug 2024 diff --git a/internal/manager/manager.go b/internal/manager/manager.go index 0f54201b..757fb0d2 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -46,6 +46,7 @@ import ( ) const defaultMetricsAddr = ":8080" +const defaultWebhookPort = 9443 var ( startTime = time.Now() @@ -62,6 +63,7 @@ var ( setupLog = ctrl.Log.WithName("setup") leaderElect = flag.Bool("leader-elect", false, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.") enableWebhooks = flag.Bool("webhook.enable", false, "adds webhook server, you must mount cert and key or use cert-manager") + webhookPort = flag.Int("webhook.port", defaultWebhookPort, "port to start webhook server on") disableCRDOwnership = flag.Bool("controller.disableCRDOwnership", false, "disables CRD ownership add to cluster wide objects, must be disabled for clusters, lower than v1.16.0") webhooksDir = flag.String("webhook.certDir", "/tmp/k8s-webhook-server/serving-certs/", "root directory for webhook cert and key") webhookCertName = flag.String("webhook.certName", "tls.crt", "name of webhook server Tls certificate inside tls.certDir") @@ -174,7 +176,7 @@ func RunManager(ctx context.Context) error { LivenessEndpointName: "/health", // port for webhook WebhookServer: webhook.NewServer(webhook.Options{ - Port: 9443, + Port: *webhookPort, CertDir: *webhooksDir, CertName: *webhookCertName, KeyName: *webhookKeyName,