Skip to content

perf(controller): tune nodescan controller cache#1234

Open
fabriziosestito wants to merge 2 commits into
kubewarden:mainfrom
fabriziosestito:perf/nodescan-cache-optimization
Open

perf(controller): tune nodescan controller cache#1234
fabriziosestito wants to merge 2 commits into
kubewarden:mainfrom
fabriziosestito:perf/nodescan-cache-optimization

Conversation

@fabriziosestito

@fabriziosestito fabriziosestito commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #1177

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Copilot AI review requested due to automatic review settings June 16, 2026 06:02
@fabriziosestito fabriziosestito requested a review from a team as a code owner June 16, 2026 06:02
@github-project-automation github-project-automation Bot moved this to Pending Review in SBOMscanner Jun 16, 2026
@fabriziosestito fabriziosestito self-assigned this Jun 16, 2026
@fabriziosestito fabriziosestito added this to the v0.12.0 milestone Jun 16, 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.

Pull request overview

This PR optimizes the controller-runtime cache configuration for node-scanning mode by stripping unneeded fields from cached Node and NodeSBOM objects, reducing memory usage in line with Issue #1177.

Changes:

  • Added a TransformStripNode cache transform to retain only node OS/architecture (plus metadata) while clearing Spec, most of Status, and managed fields.
  • Added unit tests covering the new node transform behavior.
  • Enabled per-object cache transforms (and disabled deep-copy for read-only access) for Node and NodeSBOM when cfg.NodeScan is enabled.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/controller/transform.go Adds TransformStripNode to strip Node objects down to OS/arch + minimal metadata for cache efficiency.
internal/controller/transform_test.go Adds unit test validating the node transform removes expected fields while preserving OS/arch and key metadata.
cmd/controller/main.go Enables cache transforms for Node and NodeSBOM in node-scan mode and disables deep-copy for read-only cache access.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/transform.go Outdated
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.63158% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.87%. Comparing base (5adb1bd) to head (82dd15c).
⚠️ Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
cmd/controller/main.go 0.00% 7 Missing ⚠️
internal/controller/transform.go 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1234      +/-   ##
==========================================
- Coverage   53.44%   49.87%   -3.57%     
==========================================
  Files          61       77      +16     
  Lines        5340     6498    +1158     
==========================================
+ Hits         2854     3241     +387     
- Misses       2088     2801     +713     
- Partials      398      456      +58     
Flag Coverage Δ
unit-tests 49.87% <52.63%> (-3.57%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

@alegrey91 alegrey91 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Please suppress the golangci-lint error before merging it.

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

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

Cache optimization

4 participants