Skip to content

Move bundle cache out of lru cache#7130

Open
sorindumitru wants to merge 1 commit into
spiffe:mainfrom
sorindumitru:extract-bundle-cache
Open

Move bundle cache out of lru cache#7130
sorindumitru wants to merge 1 commit into
spiffe:mainfrom
sorindumitru:extract-bundle-cache

Conversation

@sorindumitru

Copy link
Copy Markdown
Member

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
There should be no functionality change

Description of change
Similar to how we moved the JWT-SVIDs out of the cache, it makes a lot more sense to keep this outside of the LRU cache.

@sorindumitru
sorindumitru requested a review from evan2645 as a code owner July 8, 2026 18:59
Copilot AI review requested due to automatic review settings July 8, 2026 18:59
@sorindumitru
sorindumitru force-pushed the extract-bundle-cache branch from 7a0c140 to 7c6e084 Compare July 8, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

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 refactors the agent manager’s bundle handling by separating the shared bundle stream/source (BundleCache) from the workload LRU cache, similar to prior JWT-SVID cache separation, with the stated goal of no functional change.

Changes:

  • Introduces a dedicated BundleCache owned by manager, and wires it into the SVID rotator (BundleStream) and manager bundle accessors.
  • Removes bundle-stream/source responsibilities from LRUCache and trims the manager.Cache interface accordingly.
  • Enhances BundleCache.Update() to avoid unnecessary updates and to preserve the agent trust domain bundle if absent from updates.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/agent/manager/sync.go Updates the shared bundle cache during synchronization.
pkg/agent/manager/manager.go Routes bundle APIs (GetBundle(s), GetX509Bundle, bundle stream) through the new shared BundleCache; trims Cache interface.
pkg/agent/manager/config.go Creates and injects the new BundleCache (including wiring rotator to its bundle stream).
pkg/agent/manager/cache/lru_cache.go Removes embedded bundle cache/source behavior from LRUCache.
pkg/agent/manager/cache/lru_cache_test.go Adjusts bundle-change tests to reflect the new standalone bundle cache.
pkg/agent/manager/cache/bundle_cache.go Adds change-detection/preservation logic to BundleCache.Update().
pkg/agent/api/delegatedidentity/v1/service_test.go Updates test fake manager to produce bundle streams via BundleCache.

Comment thread pkg/agent/manager/sync.go Outdated
Comment on lines +116 to +118
// Update the shared bundle cache with the latest bundles
m.bundleCache.Update(cacheUpdate.Bundles)

Comment on lines +135 to +136
func TestLRUCacheBundleChanges(t *testing.T) {
cache := newTestLRUCache(t)
bundleCache := NewBundleCache(trustDomain1, bundleV1)
@sorindumitru
sorindumitru force-pushed the extract-bundle-cache branch 2 times, most recently from 1e9f1ed to 3f42322 Compare July 8, 2026 19:56
Similar to how we moved the JWT-SVIDs out of the cache, it makes
a lot more sense to keep this outside of the LRU cache.

Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
@sorindumitru
sorindumitru force-pushed the extract-bundle-cache branch from 3f42322 to 1a0cf7f Compare July 9, 2026 04:51
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.

3 participants