Option to disable automatic cloud-provider detection
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
## Motivation
The current implementation assumes that CSP’s metadata API (http://169.254.169.254) returns proper error codes (e.g., HTTP 404) when accessed with incompatible request formats (without specific HTTP header, non-existent path, etc.). Upon this assumption, it uses `asyncio.staggered.staggered_race()` to achieve “happy eyeballs” by concurrently querying the metadata API using the AWS/GCP/Azure-specific request formats and takes the first winner as the determined cloud provider.
As we add support to Vultr and explore the metadata API behavior of other cloud providers such as Oracle, Rackspace and OpenStack, we found that this approach no longer works! :melting_face:
For instance, Vultr’s metadata API always returns HTTP 200 OK when the path is not prefixed by the API version number like `/v1`. So all AWS/GCP/Azure-formatted probing requests are reported as succeeded and the detection result is “randomly” chosen depending on individual query results. Rackspace and OpenStack shares similar API formats while OpenStack offers an EC2-compatible API, too.
We need to reimplement the auto-detection logic to use a priority-based selection depending on the evidence level of per-cloud probing results while initial probing for multiple clouds may look successful on specific setups like Vultr.
## Required Features
- In the meanwhile, let’s add an option to disable the automatic cloud-provider detection via an environment variable.
JIRA Issue: BA-2554
Contributor guide
Assessment
This issue has not been assessed yet.