Skip to content

Commit

Permalink
fix memory leak by setting logger for controller-runtime in keda-adap…
Browse files Browse the repository at this point in the history
…ter (#1654)

* Set logger for controller-runtime

Signed-off-by: Ruofeng Lei <ruofenglei@outlook.com>

* Update changelog and run the pre-commit hook

Signed-off-by: Ruofeng Lei <ruofenglei@outlook.com>
  • Loading branch information
abowloflrf authored Mar 4, 2021
1 parent 1593493 commit 00400f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Print correct ScaleTarget Kind in Events ([#1641](https://github.com/kedacore/keda/pull/1641))
- Fixed keda clusterroles to give permissions for clustertriggerauthentications ([#1645](https://github.com/kedacore/keda/pull/1645))
- Make `swiftURL` parameter optional for the OpenStack Swift scaler ([#1652](https://github.com/kedacore/keda/pull/1652))
- Fix memory leak of `keda-metrics-apiserver` by setting a controller-runtime logger properly ([#1654](https://github.com/kedacore/keda/pull/1654))

### Breaking Changes

Expand Down
3 changes: 3 additions & 0 deletions adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"

Expand Down Expand Up @@ -132,6 +133,8 @@ func main() {
return
}

ctrl.SetLogger(logger)

globalHTTPTimeoutStr := os.Getenv("KEDA_HTTP_DEFAULT_TIMEOUT")
if globalHTTPTimeoutStr == "" {
// default to 3 seconds if they don't pass the env var
Expand Down

0 comments on commit 00400f8

Please sign in to comment.