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

Fetch SA from apiserver #252

Merged
merged 7 commits into from
Jan 13, 2025
Merged

Conversation

haoranleo
Copy link
Contributor

@haoranleo haoranleo commented Jan 10, 2025

Issue #, if available:

Description of changes:
Based on #242.

This PR enhances the implementation introduced in #236 by adding support to proactively fetch SA missed in cache from APIServer.

  • The grace period mechanism service-account-lookup-grace-period is still honored while the cache would initiate a GET request to APIServer in the meanwhile. If the SA is retrieved by APIServer request earlier than the grace period, the pod can be mutated earlier. Otherwise, cache would still wait till grace period ends and decide to not mutate the pod.
  • The requests to the APIServer is deduplicated. All requests for the SA with same namespace/name will be deduped to a single request. So that it wouldn't create unnecessarily request volumes.
  • The requests to the APIServer is also rate limited (with rate 10 and burst rate of 20). So the API server will not be overwhelmed. Note that this change will not add additional latency to the pod mutation time other than the specified service-account-lookup-grace-period. The rate limiting is done in the generated Go routine after the item is consumed from the channel. So the channel would be consumed as fast as possible to avoid the writer being blocked in the sync path (pod mutation time) if channel is full.

Testing:

Verified in EKS cluster that fetching from APIServer would not introduce extra latency in the pod mutation time in case of initial cache miss, given the service-account-lookup-grace-period is still honored.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@haoranleo haoranleo requested a review from a team as a code owner January 10, 2025 18:51
@haoranleo haoranleo merged commit 57c2548 into aws:master Jan 13, 2025
1 check 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.

3 participants