Skip to content

change log level and fix the broken node predicate to reduce logging - #18

Closed
syutogether wants to merge 1 commit into
release-1.4/togetherfrom
syu/tcl-9438-too-many-logs-emitted-from-the-sriov-network-operator-pod
Closed

syutogether wants to merge 1 commit into
release-1.4/togetherfrom
syu/tcl-9438-too-many-logs-emitted-from-the-sriov-network-operator-pod

Conversation

@syutogether

@syutogether syutogether commented Sep 10, 2026

Copy link
Copy Markdown

Summary
The sriov-network-operator controller pod was emitting ~37M log lines/hr (~2.9 GB/hr) due to a combination of a reconcile storm and verbose INFO-level logging on hot paths.

Root cause
The Node watch handler in SetupWithManager had a bug where reflect.DeepEqual was called but its return value was discarded, so every Node update (kubelet heartbeats, status changes) triggered a full reconcile. With ~209 nodes, the controller was saturated doing back-to-back reconciles (~1 every 2 seconds), each walking all nodes and logging multiple lines per node per interface.

Changes (3 files)
controllers/sriovnetworknodepolicy_controller.go -- 3 fixes:

Fixed the broken Node watch predicate: the UpdateFunc now skips reconciliation when node labels haven't changed, dropping reconcile frequency from ~1/2s to only on actual label changes + the 5-min ResyncPeriod
"apply" policy log demoted from INFO to V(1): this fired per-policy × per-node × per-reconcile
Guarded json.Marshal behind V(2).Enabled(): avoids serializing the full NodeState JSON every node every reconcile when the log would be suppressed
api/v1/helper.go -- 1 fix:

"Update interface" log demoted from INFO to V(2): this was the single biggest log line (~40% of controller output), firing once per matching interface per node per reconcile
controllers/helper.go -- 1 fix:

"FindNodePoolConfig():" log demoted from INFO to V(1): fired once per node per reconcile
Expected impact
The predicate fix alone reduces reconcile volume by ~2 orders of magnitude. Combined with the log level changes and a chart-level logLevel: 0 setting, overall controller log output should drop from ~37M lines/hr to low thousands.

@github-actions

Copy link
Copy Markdown

Thanks for your PR,
To run vendors CIs, Maintainers can use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs, Maintainers can use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@broly-code-security-scanner

Copy link
Copy Markdown

Broly Security Scan

Warning

Latest baseline snapshot is stale. Broly is running in PR-only fallback mode until the next scheduled baseline refreshes. This does not block the PR.

Note

Clean scan
No vulnerabilities detected in this PR.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.3) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Exploit Chains · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

@lbogdan-together

lbogdan-together commented Sep 10, 2026

Copy link
Copy Markdown

Should we mirror the upstream fix (which is actually an iteration on the actual fix) and use equality.Semantic.DeepEqual() instead of reflect.DeepEqual()?

qHandler(q)
},
UpdateFunc: func(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) {
reflect.DeepEqual(e.ObjectOld.GetLabels(), e.ObjectNew.GetLabels())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What the... ?!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

reflect.DeepEqual returns a bool, but the return value was never assigned or checked -- it was called as a standalone statement and the result was thrown away. The code then unconditionally fell through to qHandler(q), enqueueing a reconcile on every single Node update regardless of whether labels changed.

This is almost certainly a bug. The intent was clearly to only reconcile when node labels change (since label changes affect which policies apply to which nodes). But as written, it was a no-op -- equivalent to not having the check at all.

@syutogether

Copy link
Copy Markdown
Author

Bogdan already had a PR fixing the issue. Closing mine.

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