-
Notifications
You must be signed in to change notification settings - Fork 449
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
[ohai][ec2][looks_like_ec2] Do not depend on metadata endpoint #1768
Conversation
For environments where full tunnel VPN is used, requiring a connection to the local metadata endpoint causes node['cloud'] = nil. At a minimum node['cloud']['provided'] attribute should be populated even if metadata can not be fetched.
before
after
|
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.
This looks dangerous, EC2 metadata service is pretty standard service and should always be available to any process running on the local network to pull important metadata from.
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.
After discussion in the PR review meeting, we believe this is a Good Change(TM). Here's the rationale:
- All the other tests are REALLY GOOD indicators that we're on EC2, checking if the MD endpoint is not necessary
- What if I configure my, say, IP space based on is-EC2, then that metadata endpoint goes down and I reconfigure all my VMs into the wrong IP space?
- There are options in EC2 to not allow your VMs to talk to to the MD endpoint because it can be sensitive
So the change seems good, but tests will fail now, so please update the tests accordingly.
Signed-off-by: Greg Batye <gbatye@gmail.com>
@jaymzh I believe the current test cover this code change: https://github.com/chef/ohai/blob/main/spec/unit/plugins/ec2_spec.rb#L316 All unit test pass locally
|
Thanks @gbatye , this looks good. If you can update it correct the lint failure, we'll get it merged. |
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.
Lint updates requested above.
For the record it looks like the socket test was added in:
Not a lot of detail as to why the other tests were often wrong and this is a while ago so kinda hard to prove conclusively if this is more reliable now without the socket test. |
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.
when you remove can_socket_connect?
I think you can remove lines 31 and 34 referring to http_helper
Attempt chef#2 to fix linters
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.
@kcbraunschweig 's request to remove the unneeded require's makes sense, can we do that before we merge?
Also, we're missing DCO on some of your committs.
per kcbraunschweig suggestion Signed-off-by: Greg Batye <gbatye@gmail.com>
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.
Signed-off-by: Greg Batye gbatye@gmail.com
@jaymzh , any pointers on how-to update DCO for all the commits? |
Attempt chef#2 to fix linters Signed-off-by: Greg Batye <gbatye@gmail.com>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
For environments where full tunnel VPN is used, requiring a connection to the local metadata endpoint causes node['cloud'] = nil. At a minimum node['cloud']['provided'] attribute should be populated even if metadata can not be fetched.
Signed-off-by: Greg Batye gbatye@gmail.com
Related Issue
#1767
Types of changes
Checklist: