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

SVID count update #5352

Merged
merged 4 commits into from
Aug 12, 2024
Merged

SVID count update #5352

merged 4 commits into from
Aug 12, 2024

Conversation

FedeNQ
Copy link
Contributor

@FedeNQ FedeNQ commented Aug 2, 2024

Pull Request check list

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

Affected functionality

Description of change
Add 3 new variables replacing svids_count, that will be deprecated.

Variables added:

  • X509SVID count
  • JWTSVID count
  • svidstoreX509SVID count

Which issue this PR fixes
fixes #3256

Signed-off-by: FedeNQ <fedenahuel07@gmail.com>
Signed-off-by: FedeNQ <fedenahuel07@gmail.com>
@amartinezfayo amartinezfayo added this to the 1.10.2 milestone Aug 11, 2024
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Thank you @FedeNQ, it's looking great!

@@ -250,6 +250,10 @@ func (c *Cache) GetStaleEntries() []*cache.StaleEntry {
return staleEntries
}

func (c *Cache) CountX509SVIDs() int {
return len(c.records)
Copy link
Member

Choose a reason for hiding this comment

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

We should lock the mutex for reading to get the length of the records.

Suggested change
return len(c.records)
c.mtx.RLock()
defer c.mtx.RUnlock()
return len(c.records)

// CountJWTSVIDs returns the amount of JWT SVIDs on memory
CountJWTSVIDs() int

CountSVIDStoreX509SVIDs() int
Copy link
Member

Choose a reason for hiding this comment

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

nit: Add a descriptive comment here as we have for the other counts.

Signed-off-by: FedeNQ <fedenahuel07@gmail.com>
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Thank you @FedeNQ!

@azdagron azdagron merged commit 0f3a3ee into spiffe:main Aug 12, 2024
33 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.

Agent Debug GetInfo method returns only count of cached X.509-SVIDs in svids_count field
3 participants