hashicorp / go-discover

Discover nodes in cloud environments
Mozilla Public License 2.0
563 stars 123 forks source link

Remove link local IPv6 addrs from Linode provider and optimize API calls #178

Closed tjhop closed 1 year ago

tjhop commented 3 years ago

Currently, the Linode provider sets the link local IPv6 address as the private IPv6 address. I am certainly not an IPv6 expert, but since that's technically not a private IP, I'd like to propose it be removed. Based on other providers, this is looks to already be an extra filtering option that most other providers don't offer.

I understand this would be a breaking change, but it's currently the only field from the Linode API that requires the per-instance IP address calls. Currently, the number of API calls required to gather IP addresses is: 1 paginated call to ListInstances() + (number_of_instances * GetInstanceIPAddresses() calls)

If we stop returning the IPv6 link local address, we can reduce the number of API calls to: 1 paginated call to ListInstances() + 1 paginated call to ListIPAdresses() and key on the Linode instance ID to gather the data we need.

Testing on my personal account, this reduces average binary runtimes considerably -- with 50 instances, my average runtimes dropped from ~20-25 seconds -> 4-6 seconds.

I have a commit that implements this change (as well as updates tests) here. Opening this issue to discuss the removal of private_v6, and I'm happy to open the PR if it's agreed to move forward. 👍