Skip to content

Commit 19f79a7

Browse files
authored
fix(kumactl): avoid logger issues by importing controller-runtime directly (#13337)
## Motivation & Implementation information Importing the `controller-runtime/log` subpackage causes global `Log` to be assigned to the delegated logger, which depends on later `SetLogger` calls. When `controller-runtime` is also imported elsewhere, this re-triggers global init logic, leading to data races and inconsistent logger behavior. This affects performance and can cause commands like `kumactl install transparent-proxy` or `kumactl install transparent-proxy-validator` to hang for several minutes. By importing `controller-runtime` directly and using its `Log`/`SetLogger` re-exports, we avoid duplicate initialization and ordering issues. ## Supporting documentation Closes: #13299 Signed-off-by: Bart Smykla <bartek@smykla.com>
1 parent 5e5e300 commit 19f79a7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/core/alias.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import (
88
"time"
99

1010
"github.com/google/uuid"
11-
kube_log "sigs.k8s.io/controller-runtime/pkg/log"
11+
kube_ctrl "sigs.k8s.io/controller-runtime"
1212

1313
kuma_log "github.com/kumahq/kuma/pkg/log"
1414
)
1515

1616
var (
1717
// TODO remove dependency on kubernetes see: https://github.com/kumahq/kuma/issues/2798
18-
Log = kube_log.Log
18+
Log = kube_ctrl.Log
1919
NewLogger = kuma_log.NewLogger
2020
NewLoggerTo = kuma_log.NewLoggerTo
2121
NewLoggerWithRotation = kuma_log.NewLoggerWithRotation
22-
SetLogger = kube_log.SetLogger
22+
SetLogger = kube_ctrl.SetLogger
2323
Now = time.Now
2424

2525
SetupSignalHandler = func() (context.Context, context.Context, <-chan struct{}) {

0 commit comments

Comments
 (0)