Skip to content
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

Allow managing IPv6 network settings #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bltavares
Copy link
Contributor

@bltavares bltavares commented Mar 17, 2019

ZeroTier has a couple of settings related to IPv6 address assignment
options which distribute IPv6 addresses computed based on the network id
and the node id.

RFC4139 assigns an single IPv6 address for each of the nodes.

6PLANE assigns a whole /80 prefix for each node, which could be
redistributed by the member, such as a router or used for Docker
containers.

Both of them are deterministic values calculated based on the network id
and node id, and they are not returned on the response of the
controller, given that the client is capable of calculating it itself.

IPv6 Assignment distribute IPv6 from the the assignment pool for each
member. If there is no IPv6 assignment pool configured, no route will be
distributed. It is important to also include the route configuration for
that network, so there is traffic through ZeroTier.

This commit exposes this information on the member resource, as a
computed property, so we could reference this information on other
Terraform resources (such as DNS settings or provisioner scripts).

Given this is a calculated property that is always present, downstream
modules should check if the network has it configured before using it.
No errors will be thrown, it would only not route properly if the
network has not enabled it.

The commit also exposes the settings in the network to enable each of
the IPv6 address distribution toggles on the network resource.

There is also a bug fix, where the IPv4 configuration toggle was
hardcoded and not reading the value from the resource definition.

@cormacrelf
Copy link
Owner

The auto_assign_6plane doesn't seem to do anything. Is that a ZT controller bug? The web UI sends this, whereas the code here only sends 6plane: true I think:

Screen Shot 2019-03-23 at 22 17 07

@bltavares
Copy link
Contributor Author

While developing I've noticed that the UI is modifying the 6PLANE: true object, which seems to be an UI bug.

I've looked at the current controller code, and how my network behaves, and it seems that 6plane is the correct value to modify.

Using 6plane does not check the checkbox on ZeroTier, but it does display an extra IPv6 entry on each of the members. Ticking or unticking the checkbox does not change the members here. Does that happen on your network as well?

ZeroTier has a couple of settings related to IPv6 address assignment
options which distribute IPv6 addresses computed based on the network id
and the node id.

RFC4139 assigns an single IPv6 address for each of the nodes.

6PLANE assigns a whole /80 prefix for each node, which could be
redistributed by the member, such as a router or used for Docker
containers.

Both of them are deterministic values calculated based on the network id
and node id, and they are not returned on the response of the
controller, given that the client is capable of calculating it itself.

IPv6 Assignment distribute IPv6 from the the assignment pool for each
member. If there is no IPv6 assignment pool configured, no route will be
distributed. It is important to also include the route configuration for
that network, so there is traffic through ZeroTier.

This commit exposes this information on the member resource, as a
computed property, so we could reference this information on other
Terraform resources (such as DNS settings or provisioner scripts).

Given this is a calculated property that is always present, downstream
modules should check if the network has it configured before using it.
No errors will be thrown, it would only not route properly if the
network has not enabled it.

The commit also exposes the settings in the network to enable each of
the IPv6 address distribution toggles on the network resource.

There is also a bug fix, where the IPv4 configuration toggle was
hardcoded and not reading the value from the resource definition.
@bltavares bltavares force-pushed the manage-ipv6-settings branch from 40b0b8c to 6d1e4ee Compare March 23, 2019 18:47
@cormacrelf
Copy link
Owner

ACK, same. Maybe file on zt.

@bltavares
Copy link
Contributor Author

Given that the UI is not Open Source, I'll fill in a ticket with them

@bltavares
Copy link
Contributor Author

Reported it on the chat channel. They'll take a look at it.

@bltavares
Copy link
Contributor Author

@cormacrelf sorry to bother. Did you have time to check this change (and the others)? It would be nice to have a new release of the provider with the new additional features easy to download.

@cormacrelf
Copy link
Owner

@bltavares Sorry, I've been pretty busy. I had a few typos to fix on this one, but maybe for the rest I should just add you as a collaborator. How does that sound?

Description: "Computed RFC4193 (IPv6 /128) address. Always calculated and only actually assigned on the member if RFC4193 is configured on the network.",
Computed: true,
},
"6plane_address": {
Copy link
Contributor Author

@bltavares bltavares Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I've noticed when using this is that Terraform does not like to use directly references to this property as it begins with a number, but I also don't have a better name to propose.

So the following syntax does not compile:

variable "example" {
  default = "${zerotier_member.member.6plane_address}"
}

Instead, you need to use the dictionary access:

variable "example" {
  default = "${zerotier_member.member["6plane_address"]}"
}

Would you think of an alternative name for this?

@bltavares
Copy link
Contributor Author

@cormacrelf I didn't mean to push this work over your schedule, sorry about that.

I've published a local build on my fork, so I could use it across machines, and I was meaning just to check if there was a delay due to the ZT UI bug, or the code itself.

I would gladly help with the future changes if that is something that would help you. I would like feedbacks on the change as well, anyway. I'm ok waiting for a slot on your schedule to have that feedback, as long as you need :)

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