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

Client factory: lock by client cache key #686

Closed
wants to merge 24 commits into from

Conversation

benashz
Copy link
Collaborator

@benashz benashz commented Apr 11, 2024

Previously all calls to Get() were serialized using a single lock. This approach does not scale as the number of Vault client grows. With this change locking is done by ClientCacheKey, thereby reducing the overall contention for Vault clients.

In the case where a lifetimeWatcher fails to renew the Vault client
lease, we want all related VDS instances to be synced. This helps to
mitigate the issue where an external revocation of the client token
causes the issued secret leases to be revoked. In that case VSO would
have no idea that the token has been revoked.

The ideal TTL for the client token should be relatively short, e.g. 1m,
so as to trigger the lifetimeWatcher earlier.

In the future, VSO will be able to subscribe to lease revocation events
from Vault. In that case, VSO will be able to perform the sync
immediately.
The Client ID is the hash of the Vault secret's accessor.

- VDS: trigger sync on Vault Client ID changes
- remove the called back client from the factory's cache to ensure that
  any of its clones are purged. The next call to Sync() will get a new
  client back
- fix bogus lock handling in the factory's Get()
@benashz benashz force-pushed the VAULT-25273/client-factory-lock-by-cacheKey branch from 3b9126e to b7c785e Compare April 19, 2024 21:43
Previously all calls to Get() were serialized using a single lock. This
approach does not scale as the number of Vault client grows. With this
change locking is done by ClientCacheKey, thereby reducing the overall
contention for Vault clients.
@benashz benashz force-pushed the VAULT-25273/client-factory-lock-by-cacheKey branch from b7c785e to 5e230bd Compare April 19, 2024 22:30
… into VAULT-25273/client-factory-lock-by-cacheKey
@benashz benashz marked this pull request as ready for review April 19, 2024 23:14
@benashz benashz requested a review from a team as a code owner April 19, 2024 23:14
@benashz benashz changed the title WIP: client factory: lock by client cache key Client factory: lock by client cache key Apr 19, 2024
@benashz benashz requested a review from tvoran April 19, 2024 23:14
@benashz benashz requested a review from thyton April 19, 2024 23:14
Base automatically changed from VAULT-25273/vds-trigger-reconciliation-on-token-errors to main April 24, 2024 18:33
@benashz
Copy link
Collaborator Author

benashz commented Apr 29, 2024

Closing in favor of #716 716

@benashz benashz closed this Apr 29, 2024
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.

None yet

2 participants