googleapis / googleapis/google-cloud-go
metadata: support signaling "not on GCE"
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
**Is your feature request related to a problem? Please describe.**
Multiple components that we have running exactly same on multi-cloud/onprem environments have transitive dependency on this library, and metadata lookups for "on GCP" test keeps spamming our DNS servers.
**Describe the solution you'd like**
Please support, not only explicitly signaling via `GCE_METADATA_HOST` env var that the component is running on GCP (see https://github.com/googleapis/google-cloud-go/blob/ea00264428137471805f2ec67f04f3a5a42928fa/compute/metadata/metadata.go#L117-L121), but also signaling, via another env var or special value of existing one, that environment is not GCE one.
**Describe alternatives you've considered**
I've considered configuring local DNS resolvers to treat *.internal as local domain, not to be resolved by DNS servers. Problem is we have some .internal domains which have to be resolved by DNS servers. Configuring more specific domain (like `metadata.google.internal`) as local or as ignored/refused is not supported on local resolver that we have. Replacing local resolver to a more capable one is considered to be way much more involving compared to updating dependency to this go library and setting an environment variable.
**Additional context**
N/A
Contributor guide
Assessment
This issue has not been assessed yet.