Skip to content

Cache IMDS metadata token till it expires #2707

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

Closed
trivikr opened this issue Aug 25, 2021 · 2 comments
Closed

Cache IMDS metadata token till it expires #2707

trivikr opened this issue Aug 25, 2021 · 2 comments
Labels
closed-for-staleness feature-request New feature or enhancement. May require GitHub community feedback.

Comments

@trivikr
Copy link
Member

trivikr commented Aug 25, 2021

Is your feature request related to a problem? Please describe.

From How Instance Metadata Service Version 2 works

IMDSv2 uses session-oriented requests. With session-oriented requests, you create a session token that defines the session duration, which can be a minimum of one second and a maximum of six hours. During the specified duration, you can use the same session token for subsequent requests. After the specified duration expires, you must create a new session token to use for future requests.

In fromInstanceMetadata, the token is fetched in every call.

let token: string;
try {
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
} catch (error) {

Describe the solution you'd like

Cache IMDS metadata token till it expires, thus reducing the number of calls to metadata service.

Describe alternatives you've considered

Request customers to write custom implementation of fromInstanceMetadata which caches token.

Additional context

The feature request came up while debugging retry strategy options for RemoteProviderConfig requested in #2706

@trivikr trivikr added the feature-request New feature or enhancement. May require GitHub community feedback. label Aug 25, 2021
@github-actions
Copy link

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Aug 26, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-for-staleness feature-request New feature or enhancement. May require GitHub community feedback.
Projects
None yet
Development

No branches or pull requests

1 participant