Skip to content

Adding the option to specify the address_type for vSphere provider #242

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marknl
Copy link

@marknl marknl commented Jun 23, 2023

According to the documentation at https://developer.hashicorp.com/consul/docs/install/cloud-auto-join the vsphere provider should return the first Private IP address of the hosts matching the category and tag. This does not work. The vSphere provider returns all IP addresses of a host. (net.ip.IsPrivate() is never used in the vsphere code)

This PR adds the option for users to provide an "address_type" option that defaults to "private" so it actually returns RFC1918 addresses (as described by the documentation). Specifying "public" will return the public IP addresses.

Full Disclosure: This is my first time actually touching go-lang code. I know globals should be avoided, hence I've forwarded "addressType" to all functions to finally end up being used in the skipIPAddr function, feels nasty. No idea if there's a better solution, but it works! Feel free to implement a better method.

@hashicorp-cla
Copy link

hashicorp-cla commented Jun 23, 2023

CLA assistant check
All committers have signed the CLA.

@marknl marknl changed the title Adding the option to specify the address_type returned Adding the option to specify the address_type returned for vSphere provider Jun 23, 2023
@marknl marknl changed the title Adding the option to specify the address_type returned for vSphere provider Adding the option to specify the address_type for vSphere provider Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants