Skip to content

Fix controller runtime logger setup - #5825

Open
thardeck wants to merge 2 commits into
mainfrom
fix_controller_runtime_logger_setup
Open

thardeck wants to merge 2 commits into
mainfrom
fix_controller_runtime_logger_setup

Conversation

@thardeck

@thardeck thardeck commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

fleetcli apply, and the agentmanagement and cleanup fleet-controller subcommands, never called ctrl.SetLogger. Since logrus was replaced with the controller-runtime log.Log delegating logger, calls to it in these entrypoints are silently dropped after a 30s timeout, hiding messages such as the helmRepoURLRegex credential-stripping warning and any logging from the agentmanagement and cleanup controllers.

Wire up zap.Options and ctrl.SetLogger in these entrypoints the same way gitops and helmops already do, and drop the now-unused registerKubeconfigFlags helper.

Refers #3554

fleetcli apply, and the agentmanagement and cleanup fleet-controller
subcommands, never called ctrl.SetLogger. Since logrus was replaced
with the controller-runtime log.Log delegating logger, calls to it in
these entrypoints are silently dropped after a 30s timeout, hiding
messages such as the helmRepoURLRegex credential-stripping warning and
any logging from the agentmanagement and cleanup controllers.

Wire up zap.Options and ctrl.SetLogger in these entrypoints the same
way gitops and helmops already do, and drop the now-unused
registerKubeconfigFlags helper.
Add an AST-based test per fixed entrypoint (fleetcli apply, the
agentmanagement and cleanup fleet-controller subcommands) asserting
their Run method calls SetLogger. Without it, log.Log output is
silently dropped rather than printed.
@thardeck thardeck added this to the v2.16.0 milestone Sep 22, 2026
@thardeck thardeck self-assigned this Sep 22, 2026
@thardeck
thardeck requested a review from a team as a code owner September 22, 2026 06:36
Copilot AI lite review requested due to automatic review settings September 22, 2026 06:36
@thardeck thardeck added this to Fleet Sep 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Configures controller-runtime logging for apply, cleanup, and agentmanagement commands so controller logs are emitted correctly.

Changes:

  • Initializes zap logging in affected entrypoints.
  • Passes shared zap options to controller subcommands.
  • Removes the obsolete kubeconfig helper and adds regression tests.
File Description
internal/​cmd/​controller/​root.go Passes zap options to subcommands
internal/​cmd/​controller/​cleanup/​root.go Configures cleanup logging
internal/​cmd/​controller/​cleanup/​root_test.go Tests cleanup logger setup
internal/​cmd/​controller/​agentmanagement/​root.go Configures agentmanagement logging
internal/​cmd/​controller/​agentmanagement/​root_test.go Tests agentmanagement logger setup
internal/​cmd/​cli/​logging_setup_test.go Tests apply logger setup
internal/​cmd/​cli/​kubeconfig.go Removes the obsolete helper and updates documentation
internal/​cmd/​cli/​apply.go Registers zap flags and configures logging

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thardeck thardeck moved this to 👀 In review in Fleet Sep 22, 2026
@@ -0,0 +1,50 @@
package agentmanagement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this regression is now in place for a few locations, but if say, the bundlediff CLI were modified not to call ctrl.SetLogger anymore, it would not be covered.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants