feat: handle creation and configuration of multiple WireGuard tunnels#3226
feat: handle creation and configuration of multiple WireGuard tunnels#3226MircoBarone wants to merge 1 commit into
Conversation
|
Hi @MircoBarone. Thanks for your PR! I am @adamjensenbot.
Make sure this PR appears in the liqo changelog, adding one of the following labels:
|
eed8d0b to
aceb4aa
Compare
|
/rebase test=true |
0a09450 to
1767f22
Compare
1767f22 to
a70df72
Compare
8218c64 to
518dbb2
Compare
|
I have updated the logic to support the creation of multiple interfaces. I have added the I have also extended 169.254.18.0/30 dev liqo-tunnel proto kernel scope link src 169.254.18.2
169.254.18.0/30 dev liqo-tunnel1 proto kernel scope link src 169.254.18.2
169.254.18.0/30 dev liqo-tunnel2 proto kernel scope link src 169.254.18.2
169.254.18.0/30 dev liqo-tunnel3 proto kernel scope link src 169.254.18.2This would cause, in particular, issues with keepalives. The wireguard container entrypoint has been extended to initialize N interfaces using a fail-fast approach: if the creation of even a single interface fails, the entire container is considered failed and will exit. Additionally, all underlying interface creation functions have been refactored to support this index-based multi-tunnel logic. |
b028ef3 to
6b61345
Compare
7429e07 to
9ac65ec
Compare
|
In the commit ad92c6b I have removed the single-port flags of the wireguard container ( This change is meant to be integrated with PR #3233 and PR #3236. The idea is to update the template later on, introducing something like this: --endpoint-ports={{ if .Spec.Endpoint.Ports }}{{ range $i, $p := .Spec.Endpoint.Ports }}{{ if $i }},{{ end }}{{ $p }}{{ end }}{{ else }}{{ .Spec.Endpoint.Port }}{{ end }}I will submit the template modifications once the two PRs are merged. Let me know if you agree with this approach. |
5072e1f to
c67087f
Compare
1002df2 to
f448783
Compare
5d2402c to
f24e82b
Compare
6fe71f2 to
fa51af1
Compare
21dcb9e to
0cfad4c
Compare
|
/build |
0cfad4c to
848a117
Compare
…aces - Add '--listen-ports' and '--endpoint-ports' flags to replace legacy single-port flags. - Rework IP assignment to support per-tunnel addressing within the 169.254.18.0/24 block. - Add 'Ports' and 'NodePorts' fields to GatewayClient and GatewayServer CRDs. - Enforce strict API coherence via CEL validations: - Make port/ports and nodePort/nodePorts mutually exclusive (reject CR if both are set). - Require at least one of Port or Ports to be defined. - Prevent duplicate values within Ports and NodePorts arrays. - Implement threaded NAPI logic: - Remount '/sys' as RW (up to 100 attempts), enable threaded NAPI per interface (up to 3 attempts), and remount '/sys' back to RO. - Skip interfaces where threaded NAPI is already active or if sysfs is absent. - Update WgGatewayClient and WgGatewayServer templates: - Generate multi-port flags dynamically based on configuration. - Conditionally inject 'SYS_ADMIN' capability only when multi-tunneling is active to allow sysfs remounts. - Complete templating for the '--enable-multipath-hash-policy' flag.
848a117 to
ccd3df3
Compare
|
/test |
Description
Part of the multi-tunnel WireGuard implementation. This is the first PR related to issue #3225.
Add
--listen-portsand--endpoint-portsflags to the WireGuard container.These flags allow specifying multiple ports for the Gateway server and client, respectively.
The original idea was to also include the
--num-interfacesflag to indicate the number of WireGuard interfaces to create, but it is unnecessary and redundant: the same information can be inferred from the number of ports, maintaining a single source of truth.The existing
--listen-portand--endpoint-portflags are preserved for backward compatibility and default values. They can be ignored if values are provided in the new multi-port flags, ensuring that the existing infrastructure continues to work without changes.