-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Query IMDS over IPv6 if no IPv4 interface address #2453
Conversation
bb69646
to
71a1613
Compare
71a1613
to
a6ee3e4
Compare
Codecov ReportBase: 54.12% // Head: 54.12% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #2453 +/- ##
=======================================
Coverage 54.12% 54.12%
=======================================
Files 144 144
Lines 8268 8268
=======================================
Hits 4475 4475
Misses 3469 3469
Partials 324 324 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -44,9 +47,28 @@ type Cloud interface { | |||
|
|||
// NewCloud constructs new Cloud implementation. | |||
func NewCloud(cfg CloudConfig, metricsRegisterer prometheus.Registerer) (Cloud, error) { | |||
hasIPv4 := true | |||
addrs, err := net.InterfaceAddrs() | |||
if err == nil { |
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.
in case of error, why not return right away?
Are there situations where the net.InterfaceAddrs() return error, but we still want to continue processing?
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.
The idea was to avoid any negative effects in existing cases. So if the process doesn't have permission to enumerate the interfaces, it would assume IPv4.
hasIPv4 = false | ||
for _, addr := range addrs { | ||
str := addr.String() | ||
if !strings.HasPrefix(str, "127.") && !strings.Contains(str, ":") { |
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.
i think this check is a bit hacky.
maybe just upgrade the sdk and let users specify AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE
env variable via helm chart?
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.
Why should users have to specify AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE at all?
@@ -99,7 +98,7 @@ func (s *loadBalancerSynthesizer) disableDeletionProtection(lb *elbv2sdk.LoadBal | |||
}, | |||
LoadBalancerArn: lb.LoadBalancerArn, | |||
} | |||
_, err := svc.ModifyLoadBalancerAttributes(input) | |||
_, err := s.elbv2Client.ModifyLoadBalancerAttributes(input) |
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 is a good catch :D
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
a6ee3e4
to
3c8839c
Compare
/remove-lifecycle rotten |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers, kishorj, olemarkus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
to be honest, i still don't think we should do this from the controller. It should be AWSSDK-GO to automatically detect IMDS if necessary. And this detection feels hacky to me as well, e.g. you might have IMDS only available in ipv6 but the container have some other ipv4 addresses as well(e.g. cni's dummy ipv4 addresses for ipv6 only mode). |
I would also prefer this be done in AWSSDK-GO, but aws-sdk has stated, without any explanation or discussion, that they are not going to do that. So this would need to be done client-by-client. The PR aws/aws-sdk-go#4234 has gotten no attention in months. The container having non-loopback IPv4 addresses is an obscure corner case and is not negatively impacted by this change. Such unusual situations can still be handled by setting the environment variable. |
Issue
Description
Queries IMDS over IPv6 if there is no non-loopback IPv4 interface address.
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯