add Ports/NodePorts fields in GatewayServer and enforce (Node)Port/(Node)Ports coherence#3236
Open
MircoBarone wants to merge 4 commits intoliqotech:masterfrom
Open
add Ports/NodePorts fields in GatewayServer and enforce (Node)Port/(Node)Ports coherence#3236MircoBarone wants to merge 4 commits intoliqotech:masterfrom
MircoBarone wants to merge 4 commits intoliqotech:masterfrom
Conversation
Collaborator
|
Hi @MircoBarone. Thanks for your PR! I am @adamjensenbot.
Make sure this PR appears in the liqo changelog, adding one of the following labels:
|
20 tasks
708727f to
f21c6f1
Compare
…f controller mutation
Contributor
Author
|
As done for PR #3233, I have moved the validation logic for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of the multi-tunnel WireGuard implementation. This is the 4th PR related to issue #3225.
The
PortsandNodePortsfields were introduced inGatewayServer:Portsstores the list of WireGuard listen ports that the gateway server uses internally, one per Wireguard interface.NodePortsis an optional list of ports used to expose the interfaces externally via the Kubernetes Service.Like in the previous PR,
(Node)Portsis not meant to replace the legacy(Node)Portfield, which is kept for backward compatibility. The invariant is that(Node)Ports[0]must always be equal to(Node)Port.A function analogous to the previous PR's
EnsurePortsCoherencewas added to theServerReconciler. At the beginning of each reconcile cycle, it checks whether(Node)Portand(Node)Portsare consistent and normalizes them according to the following rules:(Node)Portis specified,(Node)Portsis set to[]int32{(Node)Port}(Node)Portsis specified,(Node)Portis overwritten with(Node)Ports[0]Port/Portsonly —NodePort/NodePortsare optional and have no default)After normalization, the resource is updated and the reconcile cycle is requeued.
Note that
NodePortsmay be shorter or longer thanPorts. The intended behavior during Service creation is:NodePortsis shorter, the remaining interfaces are exposed on ports chosen by KubernetesNodePortsis longer, the extra entries are ignorednumInterfaces, mentioned in the issue, was intentionally not introduced to keepGatewayServersimple and avoid an additional source of truth with potential inconsistencies. Future extensions may include:numInterfacesand auto-generating the missing portsliqotech peer, to generate ports given a desired count