From 697a39fab72d8b459c488cc1162705bc1cb813be Mon Sep 17 00:00:00 2001 From: yuval weber Date: Tue, 17 Oct 2023 16:13:30 +0300 Subject: [PATCH 1/5] Support profiling for keda components Signed-off-by: yuval weber --- CHANGELOG.md | 1 + cmd/adapter/main.go | 9 ++++++--- cmd/operator/main.go | 3 +++ cmd/webhooks/main.go | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99796d7a77d..443126de8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ Here is an overview of all new **experimental** features: ### Improvements +- **General:** Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789) - **General**: Add parameter queryParameters to prometheus-scaler ([#4962](https://github.com/kedacore/keda/issues/4962)) - **General**: TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) - **Hashicorp Vault**: Add support to get secret that needs write operation (e.g. pki) ([#5067](https://github.com/kedacore/keda/issues/5067)) diff --git a/cmd/adapter/main.go b/cmd/adapter/main.go index cea7ff84238..c63a973c7f2 100644 --- a/cmd/adapter/main.go +++ b/cmd/adapter/main.go @@ -61,6 +61,7 @@ var ( metricsAPIServerPort int disableCompression bool metricsServiceAddr string + profilingAddr string ) func (a *Adapter) makeProvider(ctx context.Context) (provider.ExternalMetricsProvider, <-chan struct{}, error) { @@ -111,9 +112,10 @@ func (a *Adapter) makeProvider(ctx context.Context) (provider.ExternalMetricsPro Cache: ctrlcache.Options{ DefaultNamespaces: namespaces, }, - LeaseDuration: leaseDuration, - RenewDeadline: renewDeadline, - RetryPeriod: retryPeriod, + PprofBindAddress: profilingAddr, + LeaseDuration: leaseDuration, + RenewDeadline: renewDeadline, + RetryPeriod: retryPeriod, }) if err != nil { logger.Error(err, "failed to setup manager") @@ -231,6 +233,7 @@ func main() { cmd.Flags().AddGoFlagSet(flag.CommandLine) // make sure we get the klog flags cmd.Flags().IntVar(&metricsAPIServerPort, "port", 8080, "Set the port for the metrics API server") cmd.Flags().StringVar(&metricsServiceAddr, "metrics-service-address", generateDefaultMetricsServiceAddr(), "The address of the gRPRC Metrics Service Server.") + cmd.Flags().StringVar(&profilingAddr, "profiling-bind-address", "", "The address the profiling would be exposed on.") cmd.Flags().Float32Var(&adapterClientRequestQPS, "kube-api-qps", 20.0, "Set the QPS rate for throttling requests sent to the apiserver") cmd.Flags().IntVar(&adapterClientRequestBurst, "kube-api-burst", 30, "Set the burst for throttling requests sent to the apiserver") cmd.Flags().BoolVar(&disableCompression, "disable-compression", true, "Disable response compression for k8s restAPI in client-go. ") diff --git a/cmd/operator/main.go b/cmd/operator/main.go index 8a6d8043ad5..d72ff9b425b 100644 --- a/cmd/operator/main.go +++ b/cmd/operator/main.go @@ -67,6 +67,7 @@ func main() { var metricsAddr string var probeAddr string var metricsServiceAddr string + var profilingAddr string var enableLeaderElection bool var adapterClientRequestQPS float32 var adapterClientRequestBurst int @@ -84,6 +85,7 @@ func main() { pflag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the prometheus metric endpoint binds to.") pflag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") pflag.StringVar(&metricsServiceAddr, "metrics-service-bind-address", ":9666", "The address the gRPRC Metrics Service endpoint binds to.") + pflag.StringVar(&profilingAddr, "profiling-bind-address", "", "The address the profiling would be exposed on.") pflag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") @@ -151,6 +153,7 @@ func main() { DefaultNamespaces: namespaces, }, HealthProbeBindAddress: probeAddr, + PprofBindAddress: profilingAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "operator.keda.sh", LeaseDuration: leaseDuration, diff --git a/cmd/webhooks/main.go b/cmd/webhooks/main.go index 1ad2cbec2f1..0670081712f 100644 --- a/cmd/webhooks/main.go +++ b/cmd/webhooks/main.go @@ -55,6 +55,7 @@ func init() { func main() { var metricsAddr string var probeAddr string + var profilingAddr string var webhooksClientRequestQPS float32 var webhooksClientRequestBurst int var certDir string @@ -62,6 +63,7 @@ func main() { pflag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") pflag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") + pflag.StringVar(&profilingAddr, "profiling-bind-address", "", "The address the profiling would be exposed on.") pflag.Float32Var(&webhooksClientRequestQPS, "kube-api-qps", 20.0, "Set the QPS rate for throttling requests sent to the apiserver") pflag.IntVar(&webhooksClientRequestBurst, "kube-api-burst", 30, "Set the burst for throttling requests sent to the apiserver") pflag.StringVar(&certDir, "cert-dir", "/certs", "Webhook certificates dir to use. Defaults to /certs") @@ -96,6 +98,7 @@ func main() { }, }), HealthProbeBindAddress: probeAddr, + PprofBindAddress: profilingAddr, }) if err != nil { setupLog.Error(err, "unable to start admission webhooks") From fd0c4e0d73126e796e6c83b16a6b8b1dc4675eea Mon Sep 17 00:00:00 2001 From: yuval weber Date: Tue, 17 Oct 2023 17:31:03 +0300 Subject: [PATCH 2/5] Update CHANGELOG.md Signed-off-by: yuval weber --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 443126de8e6..e1f257b86b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,7 @@ Here is an overview of all new **experimental** features: ### Improvements -- **General:** Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789) +- **General:** Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) - **General**: Add parameter queryParameters to prometheus-scaler ([#4962](https://github.com/kedacore/keda/issues/4962)) - **General**: TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) - **Hashicorp Vault**: Add support to get secret that needs write operation (e.g. pki) ([#5067](https://github.com/kedacore/keda/issues/5067)) From cc1f96eea93711626154ccca387aa188b9d55e77 Mon Sep 17 00:00:00 2001 From: yuval weber Date: Tue, 17 Oct 2023 17:40:23 +0300 Subject: [PATCH 3/5] Update CHANGELOG.md Signed-off-by: yuval weber --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1f257b86b9..f7bb1b0e111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,7 @@ Here is an overview of all new **experimental** features: ### Improvements -- **General:** Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) +- **General**: Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) - **General**: Add parameter queryParameters to prometheus-scaler ([#4962](https://github.com/kedacore/keda/issues/4962)) - **General**: TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) - **Hashicorp Vault**: Add support to get secret that needs write operation (e.g. pki) ([#5067](https://github.com/kedacore/keda/issues/5067)) From 2fc7a81c969862f78f89a3d2612b54dd280758f5 Mon Sep 17 00:00:00 2001 From: yuval weber Date: Tue, 17 Oct 2023 18:23:07 +0300 Subject: [PATCH 4/5] Update CHANGELOG.md Signed-off-by: yuval weber --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7bb1b0e111..c9f502d504c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,8 +60,8 @@ Here is an overview of all new **experimental** features: ### Improvements -- **General**: Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) - **General**: Add parameter queryParameters to prometheus-scaler ([#4962](https://github.com/kedacore/keda/issues/4962)) +- **General**: Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) - **General**: TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) - **Hashicorp Vault**: Add support to get secret that needs write operation (e.g. pki) ([#5067](https://github.com/kedacore/keda/issues/5067)) - **Kafka Scaler**: Ability to set upper bound to the number of partitions with lag ([#3997](https://github.com/kedacore/keda/issues/3997)) From cf0f99e1af21b1dfe6b3b33ff309f3951c9e2fad Mon Sep 17 00:00:00 2001 From: yuval weber Date: Wed, 18 Oct 2023 14:28:16 +0300 Subject: [PATCH 5/5] Update CHANGELOG.md Co-authored-by: Zbynek Roubalik Signed-off-by: yuval weber --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f502d504c..8db84951b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,7 +61,7 @@ Here is an overview of all new **experimental** features: ### Improvements - **General**: Add parameter queryParameters to prometheus-scaler ([#4962](https://github.com/kedacore/keda/issues/4962)) -- **General**: Support profiling for keda components ([#4789](https://github.com/kedacore/keda/issues/4789)) +- **General**: Support profiling for KEDA components ([#4789](https://github.com/kedacore/keda/issues/4789)) - **General**: TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) - **Hashicorp Vault**: Add support to get secret that needs write operation (e.g. pki) ([#5067](https://github.com/kedacore/keda/issues/5067)) - **Kafka Scaler**: Ability to set upper bound to the number of partitions with lag ([#3997](https://github.com/kedacore/keda/issues/3997))