bhouse-nexthop opened a new issue, #14801: URL: https://github.com/apache/cloudstack/issues/14801
### problem `removeNodesFromKubernetesCluster` does not check that the node ids belong to the cluster, or that they are nodes added with `addNodesToKubernetesCluster`. It only checks that each VM exists and that the caller can operate on it. Every id is handed to the remove worker, which: - drains and deletes the node from Kubernetes (by VM display name) - runs the remove script with `kubeadm reset` on the VM, if it has a port forwarding rule on port 22 from 2222 up - revokes the VM's port forwarding and firewall rules - lowers the cluster's node count, memory and cores What happens for each kind of id: | id passed | result | |---|---| | VM in no cluster | processed, node count lowered | | VM of another cluster | processed, that cluster's SSH rules for the VM revoked | | control node of this cluster | drained, reset, SSH rule revoked | | etcd node | processed | | CKS-managed worker | reset and detached but VM left running, node count lowered | | node added with addNodesToKubernetesCluster | removed (expected) | The command doc says it "Removes external nodes from a CKS cluster", and the UI only lists external nodes, but the API does not enforce this. The command also doesn't check `isCommandSupported`, so it runs on ExternalManaged clusters too. ### versions 4.21.0 and later (4.22 branch, main) ### The steps to reproduce the bug 1. Create a CKS cluster. 2. Call `removeNodesFromKubernetesCluster id=<cluster> nodeids=<control node VM id>`. 3. The control node is drained and reset, and its SSH port forwarding rule is revoked. ### What to do about it? Reject the request with a clear parameter error naming the VM unless each id is a `kubernetes_cluster_vm_map` row of this cluster with `external_node` set and neither `control_node` nor `etcd_node` set. Also reject the command on cluster types that don't support it. -- 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]
