Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spire-agent: limit JWT-SVID cache size #5633

Merged
merged 6 commits into from
Nov 21, 2024

Conversation

sorindumitru
Copy link
Contributor

Pull Request check list

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

Affected functionality
spire-agent JWT-SVID cache

Description of change
This PR makes the maximum size of the JWT-SVID cache in spire-agent configurable. This avoid the cache becoming too large and using too much memory. When the cache becomes too big, the least recently used JWT-SVID is evicted.

There's more improvements that can be made here. We could also periodically try to evict expired tokens, since tokens can have different TTLs. Opening this for now to see if that's a desired behaviour.

Which issue this PR fixes
fixes #4891

Copy link
Collaborator

@rturner3 rturner3 left a comment

Choose a reason for hiding this comment

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

Overall looks good to me @sorindumitru, just had a few minor comments

pkg/agent/manager/cache/jwt_cache.go Outdated Show resolved Hide resolved
pkg/agent/manager/cache/jwt_cache_test.go Outdated Show resolved Hide resolved
pkg/agent/manager/cache/jwt_cache_test.go Show resolved Hide resolved
pkg/agent/manager/cache/jwt_cache_test.go Outdated Show resolved Hide resolved
Signed-off-by: Sorin Dumitru <sdumitru@bloomberg.net>
Signed-off-by: Sorin Dumitru <sdumitru@bloomberg.net>
Signed-off-by: Sorin Dumitru <sdumitru@bloomberg.net>
Signed-off-by: Sorin Dumitru <sdumitru@bloomberg.net>
Signed-off-by: Sorin Dumitru <sdumitru@bloomberg.net>
Copy link
Collaborator

@rturner3 rturner3 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, @sorindumitru!

@rturner3 rturner3 added this to the 1.11.1 milestone Nov 21, 2024
@rturner3 rturner3 merged commit 34c697a into spiffe:main Nov 21, 2024
34 checks passed
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.

Convert the Agent JWT Cache into a fixed entry count cache
4 participants