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

Rework IP fields in database #1828

Closed
kradalby opened this issue Mar 14, 2024 · 0 comments · Fixed by #1869
Closed

Rework IP fields in database #1828

kradalby opened this issue Mar 14, 2024 · 0 comments · Fixed by #1869
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@kradalby
Copy link
Collaborator

This issue describes a long standing frustration, and is associated with a couple of other issues that will be breaking and used to be harder to solve. Since we break a bunch of stuff for 0.23.0, let us break some more.

Currently we store IPs in a very hacky list in the database from way back and issue #295 was created, one of the reasons is that we allowed for multiple prefixes to be defined (so multiple ipv4 or ipv6). These didnt really have an effect and we have now changed this to only allow one of each:

prefixes:
  v6: fd7a:115c:a1e0::/48
  v4: 100.64.0.0/10

Naturally, this means that machines will get one of each address, and this allows us to simplify the model for this in the database. Instead of having one list, we can have two colums: v4 and v6, containing the ip of the machine, and logic that automatically pulls it out as a netip.Addr. This will make the developer ergonomics a lot neater and simpler.

This simplification, with the help of the new IP allocator (#1756) should allow us to more easily fix a bunch of outstanding (and longstanding) issues:

The migration logic can be a bit hairy, what if some people, somehow has multiple addrs of the same family in the list in the database?

@kradalby kradalby added bug Something isn't working enhancement New feature or request labels Mar 14, 2024
kradalby added a commit to kradalby/headscale that referenced this issue Apr 12, 2024
This commit migrates the list in ip_addresses column into
two separate columns, ipv4 and ipv6 and puts them into dedicated
types.

Followup commit updates types everywhere and in tests.

Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 12, 2024
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
This commit migrates the list in ip_addresses column into
two separate columns, ipv4 and ipv6 and puts them into dedicated
types.

Followup commit updates types everywhere and in tests.

Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Fixes juanfont#968
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
@kradalby kradalby added this to the v0.23.0 milestone Apr 15, 2024
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Fixes juanfont#968
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Fixes juanfont#968
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
This commit migrates the list in ip_addresses column into
two separate columns, ipv4 and ipv6 and puts them into dedicated
types.

Followup commit updates types everywhere and in tests.

Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 15, 2024
Fixes juanfont#968
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Apr 16, 2024
Fixes juanfont#968
Updates juanfont#1828

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant