bhouse-nexthop opened a new pull request, #14833:
URL: https://github.com/apache/cloudstack/pull/14833

   ### Description
   
   Fixes #14832
   
   `addNodesToKubernetesCluster` now rejects the whole request when any VM is 
invalid, instead of dropping that VM and adding the rest.
   
   | VM passed | before | after |
   |---|---|---|
   | removed (expunged) VM | dropped | rejected |
   | template not found or deleted | dropped | rejected |
   | template not marked for CKS | dropped | rejected |
   | default NIC not on the cluster network | dropped | rejected |
   | VM with no default NIC | NullPointerException | rejected |
   | VM already in this cluster | dropped | rejected |
   | valid VM | added | added |
   
   - `validateNodes` collects every reason and throws one 
`InvalidParameterValueException`, e.g. `Unable to add the nodes to the 
Kubernetes cluster: VM <uuid> is deployed with template <uuid>, which is not 
marked for CKS; VM <uuid> does not have its default NIC in the Kubernetes 
cluster network <name>`.
   - Nothing is touched before the check, so a rejected request leaves the 
cluster as it was.
   - A retry after a partly failed add now names the VMs already in the cluster 
rather than skipping them.
   - `removeNodesFromKubernetesCluster` is unchanged.
   - No schema change.
   
   Related open PRs in the same code:
   
   | PR | merge with this one |
   |---|---|
   | #14796 (`validateNodes` re-add, dedup) | one conflict in `validateNodes`: 
keep #14796's signature, dedup and `listByVmId` loop, add `invalidNodes`, and 
in that loop replace `logger.warn` + `validNodeIds.remove(id)` with 
`invalidNodes.add(... mappedCluster.getUuid())`. Its two "rejects" tests then 
expect the exception. Resolved and tested: 97/97 plugin tests pass. |
   | #14802 (remove-side validation) | clean, tests pass together |
   | #14819, #14781, #14798 (add worker) | clean |
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   
   ### Bug Severity
   
   - [x] Major
   
   ### How Has This Been Tested?
   
   - `KubernetesClusterManagerImplTest`: 9 new tests, one per case above, plus 
a mixed list (one valid VM, two invalid; only the invalid ones are named), a 
valid list, and the remove path still dropping a missing VM.
   - The 7 "rejects" tests fail on the unpatched code: nothing is thrown, or an 
NPE when there is no default NIC.
   - Kubernetes plugin unit tests: 92/92 pass.
   


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