x/ref/runtime/internal: use aws imds v1 first and then v2#174
Merged
cosnicolaou merged 3 commits intomasterfrom Nov 20, 2020
Merged
x/ref/runtime/internal: use aws imds v1 first and then v2#174cosnicolaou merged 3 commits intomasterfrom
cosnicolaou merged 3 commits intomasterfrom
Conversation
richhx
reviewed
Nov 20, 2020
| body, err := awsGet(ctx, false, awsIdentityDocURL(), timeout) | ||
| if err != nil { | ||
| return false | ||
| logger.VI(1).Infof("failed to access v1 metadata service: %v", err) |
Member
There was a problem hiding this comment.
thanks for adding logs, should help a lot with debugging problems like this in the future :)
richhx
reviewed
Nov 20, 2020
| var ( | ||
| onceAWS sync.Once | ||
| onAWS bool | ||
| imdsv2 bool |
Member
There was a problem hiding this comment.
Maybe rename this to onImdsv2 or something different than imdvs2 since local functions override the scope and is a little confusing
richhx
reviewed
Nov 20, 2020
| func testAWSIDMSVersion(t *testing.T, imdsv2Only bool) { | ||
| ctx := context.Background() | ||
| host, stop := startAWSMetadataServer(t) | ||
| host, stop := startAWSMetadataServer(t, false) |
Member
There was a problem hiding this comment.
why is this false? Should imdvs2Only be passed instead?
richhx
reviewed
Nov 20, 2020
|
|
||
| externalURL := host + cloudpaths.AWSPublicIPPath + "/noip" | ||
| noip, err := awsGetAddr(ctx, externalURL, time.Second) | ||
| noip, err := awsGetAddr(ctx, false, externalURL, time.Second) |
Member
There was a problem hiding this comment.
Similarly why is this false rather than imdvs2Only?
richhx
approved these changes
Nov 20, 2020
Member
richhx
left a comment
There was a problem hiding this comment.
Generally LGTM with some minor comments. Not sure why build is failing though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
AWS' instance meta data service cannot be accessed from a docker container running in bridge mode. This PR changes the behaviour to use the v1 service first and only if that fails, to use the v2 service. This fallback is required since it's possible to
configure aws instances to allow v2 only.