googleapis / googleapis/google-cloud-go
metadata: bad default value for IPv6 only environements
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
## Environment
IPv6 only kubernetes pods
## Code and Dependencies
Looking at this code:
https://github.com/googleapis/google-cloud-go/blob/18dec3a31f1d24dfa1dc58eeb532991336772dac/compute/metadata/metadata.go#L520-L527
Even in an IPv6 only environment, we will always try http://169.254.169.254. This means that users must set GCE_METADATA_HOST.
## Expected behavior
If IPv4 is not enabled but IPv6 is enabled, then we should default to the IPv6 address. Or we should try multiple values.
(I'm assuming we can tell from inside a kubernetes Pod that we are IPv6 only, in a reasonable efficient way)
## Actual behavior
We default to an IP address that we (could) know cannot work.
## Additional context
Setting GCE_METADATA_HOST to the correct value works (and Gemini suggests `export GCE_METADATA_HOST="fe80::1%eth0"`), but it feels like this is easy for us to fix in the SDK.
I am happy to send a PR if we agree that we can fix this, at least for the case when we _know_ that IPv4 is not enabled.
Contributor guide
Assessment
This issue has not been assessed yet.