Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.namespace/name
will be deduped to a single request. So that it wouldn't create unnecessarily request volumes.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.