Skip to content

fix(sandbox-manager): reduce log volume in proxy and infra reconciler#579

Open
AiRanthem wants to merge 1 commit into
openkruise:masterfrom
AiRanthem:fix/fewer-logs-260625
Open

fix(sandbox-manager): reduce log volume in proxy and infra reconciler#579
AiRanthem wants to merge 1 commit into
openkruise:masterfrom
AiRanthem:fix/fewer-logs-260625

Conversation

@AiRanthem

Copy link
Copy Markdown
Member

Ⅰ. Describe what this PR does

Reduces unnecessary log noise in the sandbox-manager process by:

  1. Proxy handleRefresh: Replaced web.RegisterRoute framework with plain http.HandlerFunc for the internal system port (7789). This endpoint only serves inter-pod route refresh calls and doesn't need request ID generation, panic recovery wrapper, or the full web framework overhead. Log verbosity raised to V(DebugLogLevel+1).

  2. Infra refreshRoute: Changed to return a bool indicating whether the route actually changed, so the "route refreshed" debug log only fires on real updates — not on every reconcile cycle where the route is already current.

  3. Cache controller: Removed a debug log that fired on every reconcile when no handlers are registered — a normal steady-state condition that doesn't need logging.

  4. Bug fix: refreshRoute was using sbx.GetName() to look up routes, but routes are keyed by utils.GetSandboxID(sbx) (namespace + name). Fixed to use the correct key.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Describe how to verify it

  1. Run affected unit tests:
    go test ./pkg/proxy/... ./pkg/cache/controllers/... ./pkg/sandbox-manager/infra/... -count=1
  2. Deploy and observe log output — route refresh logs should only appear when state/IP actually changes.

Ⅳ. Special notes for reviews

  • The handleRefresh endpoint is internal-only (port 7789, used for peer route sync). Removing the web.RegisterRoute wrapper is safe — Go's net/http server has built-in per-connection panic recovery.
  • The sandbox ID bug fix (item 4) is the most impactful change — in multi-namespace deployments, GetName() alone could miss routes that are keyed with the full namespace/name format.

conditionally log sandbox route refresh only when updated

downgrade access logs and internal traces for refresh APIs

remove redundant debug log for empty reconcile handlers
@kruise-bot kruise-bot requested review from furykerry and zmberg June 25, 2026 06:52
@kruise-bot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign furykerry for approval by writing /assign @furykerry in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.76%. Comparing base (af25739) to head (d6f2c7a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #579      +/-   ##
==========================================
- Coverage   79.78%   79.76%   -0.03%     
==========================================
  Files         202      202              
  Lines       14688    14720      +32     
==========================================
+ Hits        11719    11741      +22     
- Misses       2544     2550       +6     
- Partials      425      429       +4     
Flag Coverage Δ
unittests 79.76% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants