Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/hubagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/metrics"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
Expand Down Expand Up @@ -105,6 +106,10 @@
klog.ErrorS(errs.ToAggregate(), "invalid parameter")
exitWithErrorFunc()
}

// Set up controller-runtime logger
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider making the zap logger's development mode configurable to allow switching between development and production logging settings.

Suggested change
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
ctrl.SetLogger(zap.New(zap.UseDevMode(devMode)))

Copilot uses AI. Check for mistakes.

Check warning on line 112 in cmd/hubagent/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/hubagent/main.go#L111-L112

Added lines #L111 - L112 were not covered by tests
config := ctrl.GetConfigOrDie()
config.QPS, config.Burst = float32(opts.HubQPS), opts.HubBurst

Expand Down
4 changes: 4 additions & 0 deletions cmd/memberagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down Expand Up @@ -112,6 +113,9 @@
klog.InfoS("flag:", "name", f.Name, "value", f.Value)
})

// Set up controller-runtime logger
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider making the logger mode configurable (e.g., via a command-line flag or environment variable) instead of hard-coding dev mode to better support production environments.

Suggested change
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
ctrl.SetLogger(zap.New(zap.UseDevMode(*devMode)))

Copilot uses AI. Check for mistakes.

Check warning on line 118 in cmd/memberagent/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/memberagent/main.go#L117-L118

Added lines #L117 - L118 were not covered by tests
// Validate flags
if !*enableV1Alpha1APIs && !*enableV1Beta1APIs {
klog.ErrorS(errors.New("either enable-v1alpha1-apis or enable-v1beta1-apis is required"), "Invalid APIs flags")
Expand Down
Loading