Skip to content

fix(provider): show controller-runtime logs with --debug - #453

Open
henrysachs wants to merge 1 commit into
masterfrom
fix/controller-runtime-debug-logger
Open

henrysachs wants to merge 1 commit into
masterfrom
fix/controller-runtime-debug-logger

Conversation

@henrysachs

Copy link
Copy Markdown
Collaborator

Why

--debug should give controller-runtime a real logger, but its logs never appear. main sets a discard logger first and the debug logger second. controller-runtime keeps only the first SetLogger call, so the discard logger always wins. This has been the case since v0.9.0.

What changed

  • main calls ctrl.SetLogger once. It passes the debug logger with --debug and the discard logger otherwise.

Scope

  • Without --debug nothing changes. controller-runtime still gets the discard logger.
  • Log levels and the provider's own logger do not change.

Blast Radius

Only --debug output changes. It now includes controller-runtime lines, such as controller start-up, and errors logged through the manager logger, such as gated controller setup failures.

Verification

  • I ran the provider locally against a kind cluster. With --debug, master printed no controller-runtime lines. This branch printed 81 "Starting Controller" and 83 "Starting EventSource" lines. Without --debug, both printed nothing.
  • With --debug, this branch also printed a gate setup error that master hides: "controller with name providerconfig/providerconfig.gitlab.m.crossplane.io already exists". fix(config): register ClusterProviderConfig controller on SafeStart #452 fixes that error.
  • go build ./..., go test ./pkg/... ./cmd/..., golangci-lint run ./..., and go generate -tags generate ./apis/... ./pkg/... (no diff) pass.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review. I ran the checks above instead.

Signed-off-by: Henry Sachs <henry.sachs@deutschebahn.com>
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.

1 participant