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
metadata: issue with DNS search #7165
Comments
Actually I think a less niche case: when actually on GCE, but if
|
To be clear are you saying that just switching this to absolute lookup this resolves the issue are seeing. Or are you saying we should additionally be checking for the well-known IP from the lookup as well? |
This is already done, so yes just switching to absolutely lookup |
Haha you are right. This seems reasonable to me and likely just an oversight. |
This has been released as compute/metadata@0.2.3 |
Client
Go metadata
Environment
All
Go Environment
$ go version
$ go env
Code
e.g.
Expected behavior
This returns "true" only on GCE
Actual behavior
There exists some edge cases where this may not be true. To reproduce, you can build the above program. i added some extra logging to the OnGCE call..
If we change
addrs, err := resolver.LookupHost(ctx, "metadata.google.internal")
toaddrs, err := resolver.LookupHost(ctx, "metadata.google.internal.")
to do an absolute lookup, this is avoided.You'll note in my example, we resolved
metadata.google.internal.com
. This has some IPs, but not169.254.169.254
, so we still return false. I could have had a domain, however, that actually does return 169.254.169.254 as an IP address, along with other IPs.This is extremely niche, but it seems like using the Fully-Qualified Domain Names with a trailing
.
would be preferred in all cases anyways?The text was updated successfully, but these errors were encountered: