bhouse-nexthop opened a new pull request, #14819: URL: https://github.com/apache/cloudstack/pull/14819
### Description `addNodesToKubernetesCluster` now fails when a node is not added, instead of returning success with a "nodes added: 0 out of 1" event. Fixes: #14818 | case | before | after | |---|---|---| | no node added | job succeeds | job fails: `Failed to add 1 of 1 nodes to Kubernetes cluster <name> (<uuid>). Not added: <vm> (<uuid>). Added: none` | | some nodes added | job succeeds | job fails, error lists the VMs not added and the ones added | | all nodes added | job succeeds | unchanged | Why a partial add fails rather than succeeds: - The request asked for N nodes and didn't get them; the caller has to act, so a success return is misleading. - The nodes that were added stay in the cluster, as today (node count and VM map already include them). The error lists them, so the caller retries only the rest. - Same shape as scale/start, which fail when the cluster doesn't end up as requested. Other details: - The error is logged and recorded as the NODES_ADD ERROR event (as before), then the CKS ISO is detached; a failed detach is logged and doesn't replace the error. - The failed-add state transition now happens once, in the worker's existing catch, which rethrows a `CloudRuntimeException` as is instead of wrapping it, so the API error is the message rather than `com.cloud.utils.exception.CloudRuntimeException: ...`. `KubernetesClusterAddWorker` only. Same code is on main. Related open PRs in the same worker; each was test-merged with this one and merges cleanly: - #14775 (revert of a failed add-node) - #14798 (SSH port for added nodes); the catch rethrow change is identical in both - #14796 (re-adding a removed node) - #14781 (user data size check) Unit tests go in a new `KubernetesClusterAddWorkerResultTest`, so they don't collide with the `KubernetesClusterAddWorkerTest` those PRs add. Not changed here: the ready-node count check after a successful add still only logs. Making it fail could fail an add because an unrelated existing node is NotReady, or because node setup used up the add-node timeout. ### 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 `KubernetesClusterAddWorkerResultTest` (4 tests): message with no node added, with a partial add, with a VM that can't be found, and the ERROR event. - `mvn -pl plugins/integrations/kubernetes-service test -Dtest='KubernetesClusterAddWorkerResultTest,KubernetesClusterActionWorkerTest,KubernetesClusterManagerImplTest'`: all pass. Checkstyle clean. #### How did you try to break this feature and the system with this change? - Partial add, all-failed add, and a VM row missing when the message is built. - Merged with #14775, #14798, #14796 and #14781 one at a time: no conflicts. -- 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]
