metal-stack / metal-api

API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more
GNU Affero General Public License v3.0
126 stars 9 forks source link

Fix bug on checking headscale connection. #536

Closed Gerrit91 closed 4 weeks ago

Gerrit91 commented 1 month ago

This bug can lead to flapping VPN connections for machines in case a machine was already allocated before but through a different project. Because we used a map implementation, the behavior was pretty much non-deterministic. See this content from headscale as an example:

❯ k exec -it headscale-cc9bbbd47-xtlbh -- headscale nodes list | grep 5e214c00-837a-11e9-8000-3cecef23001e                                                                                                                                                                                                                                                                             
608 | 5e214c00-837a-11e9-8000-3cecef23001e | 5e214c00-837a-11e9-8000-3cecef23001e-hery3tdd | [c5ISp]    | [0j/5X] | ef755a9e-37ec-4c70-a67e-f0237e799d4a | , fd7a:115c:a1e0:ab12:2000::18 | false     | 2024-06-07 14:03:49 | 0001-01-01 00:00:00 | online  | no                                                             
564 | 5e214c00-837a-11e9-8000-3cecef23001e | 5e214c00-837a-11e9-8000-3cecef23001e          | [e+RXP]    | [AbKaj] | 1eaa31c0-e092-4a3c-b795-5969b7dfd9c9 | , fd7a:115c:a1e0:ab12:2000::11 | false     | 2024-06-03 12:43:34 | 0001-01-01 00:00:00 | offline | no