bhouse-nexthop opened a new pull request, #14798: URL: https://github.com/apache/cloudstack/pull/14798
### Description This PR makes CKS add-node pick a free SSH port on the cluster's public IP instead of computing it from the node count, so it never reuses a port a live node holds after a node in the middle was removed. Fixes: #14797 | | before | after | |---|---|---| | port for an added node | 2222 + control + worker count + index | lowest port from 2222 up not used on the public IP | | after removing a node that isn't the last one | lands on a live node's port, add fails (isolated) or two PF rules share it (VPC) | reuses the freed port | | several nodes in one call | index offset | each node picks after the previous node's rules exist | | no free port | n/a | that node fails, the rest of the batch goes on | | existing nodes | | ports unchanged; with no gaps the port is the same as before | A port counts as used if any PF, LB or other non-firewall rule on the IP covers it (any protocol or state), or, on isolated networks, a tcp firewall rule for 0.0.0.0/0 with no destination CIDRs (the ones that clash with the node's own firewall rule, as in `FirewallManagerImpl#detectRulesConflict`). `KubernetesClusterAddWorker` only. Same code is on main. Related: - #14775 (revert of a failed add-node) touches the same method; the two merge with a small conflict on the port line. - Not changed here: scale and upgrade still work out external nodes' ports by position, which is already off once a node in the middle is removed. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [x] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Bug Severity - [ ] BLOCKER - [ ] Critical - [x] Major - [ ] Minor - [ ] Trivial ### How Has This Been Tested? - New `KubernetesClusterAddWorkerTest` (9 tests): no rules, contiguous nodes, gap after a removed node, LB/PF/VPN and port ranges, rules below 2222 or without ports, firewall rules that don't clash (udp, other CIDRs, destination CIDRs), VPC, no port left. - `mvn -pl plugins/integrations/kubernetes-service test -Dtest='KubernetesCluster*WorkerTest'`: all pass. #### How did you try to break this feature and the system with this change? - Ranges starting below 2222 and reaching past it, unsorted rule lists, a range up to 65535. - Not run on a live cluster. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
