-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fingerprint: handle incomplete AWS imitation APIs #7509
Conversation
Test that nomad doesn't set empty/bad network configuration when in an environment that does incomplete immitation of EC2 Metadata API.
Fix a regression where we accidentally started treating non-AWS environments as AWS environments, resulting in bad networking settings. Two factors some at play: First, in [1], we accidentally switched the ultimate AWS test from checking `ami-id` to `instance-id`. This means that nomad started treating more environments as AWS; e.g. Hetzner implements `instance-id` but not `ami-id`. Second, some of these environments return empty values instead of errors! Hetzner returns empty 200 response for `local-ipv4`, resulting into bad networking configuration. This change fix the situation by restoring the check to `ami-id` and ensuring that we only set network configuration when the ip address is not-empty. Also, be more defensive around response whitespace input. [1] #6779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, what a nasty issue. good job, and thanks for adding the tests in the first commit.
} | ||
} | ||
newNetwork = &structs.NetworkResource{ | ||
Device: "eth0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized we probably shouldn't assume network being eth0
:( - will fix that in a follow up PR to ensure that we don't override cases where a user specifically set network interface.
@notnoop thanks a lot! |
This will be in 0.11.0 - it's in beta now and should be out in final soon. |
fingerprint: handle incomplete AWS imitation APIs
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fix a regression where we accidentally started treating non-AWS
environments as AWS environments, resulting in bad networking settings.
Two factors some at play:
First, in [1], we accidentally switched the ultimate AWS test from
checking
ami-id
toinstance-id
. This means that nomad startedtreating more environments as AWS; e.g. Hetzner implements
instance-id
but not
ami-id
.Second, some of these environments return empty values instead of
errors! Hetzner returns empty 200 response for
local-ipv4
, resultinginto bad networking configuration.
This change fix the situation by restoring the check to
ami-id
andensuring that we only set network configuration when the ip address is
not-empty. Also, be more defensive around response whitespace input.
Build https://circleci.com/gh/hashicorp/nomad/51933 shows the behavior (or failures) in these environments.
[1] #6779
Fixes #7232