bhouse-nexthop opened a new issue, #14774:
URL: https://github.com/apache/cloudstack/issues/14774

   ### problem
   
   When `addNodesToKubernetesCluster` is given a VM that fails node validation 
(`validate-cks-node`), the cleanup fails and leaves that node's SSH-port 
firewall rule behind:
   
   ```
   Unable to find <id> having purpose [Firewall, Ipv6Firewall]
   ```
   
   The next add-node then fails on the same port until someone deletes the rule 
by hand.
   
   Cause, in `KubernetesClusterAddWorker.revertNetworkRules`:
   
   | step | what happens |
   |---|---|
   | firewall rule lookup | `firewallRulesDao.findByNetworkIdAndPorts(network, 
port, port)` has no purpose filter |
   | match | the node's port-forwarding rule has the same network and port, so 
it can be returned instead |
   | revoke | `revokeIngressFirewallRule(<PF rule id>)` throws, so the firewall 
rule stays |
   | rest of revert | the PF loop never runs, so the PF rule stays too |
   
   ### versions
   
   4.22 and main (the code is the same on both). Isolated network CKS cluster, 
add-node with an external VM.
   
   ### The steps to reproduce the bug
   
   1. Create a CKS cluster on an isolated network.
   2. Call `addNodesToKubernetesCluster` with a VM that fails 
`validate-cks-node` (e.g. missing dependencies).
   3. The add fails, and the management server logs the error above.
   4. `listFirewallRules` on the cluster IP still shows the node's SSH port 
rule.
   5. Run add-node again: it fails on that port.
   
   ### What to do about it?
   
   Revert only the rules the failed add created: match them by public IP and 
port (firewall: tcp, purpose Firewall; PF: destination port 22), skip rules 
that existed before, revoke PF first, then firewall, each on its own.
   


-- 
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]

Reply via email to