Skip to content

fix: Init controller-runtime logger before GetConfigOrDie#867

Merged
zhming0 merged 1 commit into
buildkite:mainfrom
nishaad78:main
Apr 21, 2026
Merged

fix: Init controller-runtime logger before GetConfigOrDie#867
zhming0 merged 1 commit into
buildkite:mainfrom
nishaad78:main

Conversation

@nishaad78
Copy link
Copy Markdown
Contributor

Summary

  • GetConfigOrDie() is currently silently failing because the controller-runtime internal logger defaults to a no-op
  • Initialize the logger via klog.SetLogger before calling GetConfigOrDie() so errors and warnings (e.g. missing kubeconfig) are surfaced through our configured slog handler

Test plan

Verify go run . output

Before:

> go run .
exit status 1

After fix:

> go run .
Apr 20 10:51:05.906 ERR config/config.go:132 unable to load in-cluster config logger=controller-runtime/client/config err="unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined"
Apr 20 10:51:05.906 ERR config/config.go:179 unable to get kubeconfig logger=controller-runtime/client/config err="invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"
exit status 1

GetConfigOrDie uses the controller-runtime internal logger, which
defaults to a no-op. This means any errors or warnings from
GetConfigOrDie (e.g. missing kubeconfig) are silently swallowed.

Initialize the logger via klog.SetLogger before the call so that
these messages are visible through our configured slog handler.
@nishaad78 nishaad78 requested a review from a team as a code owner April 20, 2026 08:56
Copy link
Copy Markdown
Contributor

@zhming0 zhming0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nishaad78 🙇🏿

@zhming0 zhming0 enabled auto-merge April 21, 2026 00:02
@zhming0 zhming0 merged commit bc5d86d into buildkite:main Apr 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants