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

   ### Description
   
   CKS now picks the control VM by its `control_node` flag in 
`kubernetes_cluster_vm_map`, not by sorting every VM id in the cluster and 
taking the one at index `etcdNodeCount`. A node added with 
`addNodesToKubernetesCluster` whose VM id is lower than the control VM's was 
being taken as the control node.
   
   Fixes: #14830
   
   | case | before | after |
   |---|---|---|
   | added (external) node has a lower VM id than the control VM | that worker 
is "control": later add-node join config, shared-network SSH and kubeconfig 
rewrite use its IP | control VM |
   | HA cluster | VM at index `etcdNodeCount` of all ids | lowest-id control VM 
that still exists, then the next |
   | flagged control VM(s) all gone | some other VM | null (callers already 
handle null) |
   | no row flagged (cluster from before `control_node` existed, or 
ExternalManaged VMs added without `isControlNode`) | lowest id (after etcd 
offset) | lowest non-etcd, non-external VM id |
   
   Callers of `fetchControlVmIfMissing`:
   
   | caller | use |
   |---|---|
   | `KubernetesClusterAddWorker` via `getControlVmPrivateIp` | API endpoint in 
the join config of added nodes |
   | `getKubernetesClusterServerIpSshPortForSharedNetwork` | SSH endpoint on 
shared/routed networks |
   | `KubernetesClusterStartWorker.isKubernetesClusterKubeConfigAvailable` | 
server address rewrite in the stored kubeconfig |
   
   Checked, not changed: `getControlNodeLoginUser`, the API port forward 
(`clusterVMIds.get(0)`) and the upgrade "wait for control Ready" (`i == 0`) use 
map-row order, where the control row comes before any later-added node.
   
   Related open PRs in the same area:
   - #14825: textual conflict in `KubernetesClusterActionWorker` / its test 
(imports and adjacent new tests only; keep both sides).
   - #14829, #14798, #14819, #14802: merge cleanly.
   
   ### 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?
   
   - `KubernetesClusterActionWorkerTest` (10 new): external node with a lower 
id; etcd nodes and an external node below the control VMs (with `etcdNodeCount` 
= 2); removed lowest control VM; flagged control gone (no fallback); unflagged 
legacy cluster; unflagged fallback skips etcd and doesn't walk to the next VM; 
only external nodes; no rows; shared-network SSH endpoint.
   - 5 of the new tests fail against the old code.
   - Whole `kubernetes-service` module: 88 tests pass, checkstyle clean.
   - Seen on a lab cluster where an existing VM was added as a node: the next 
added node's join config pointed at it. A live re-check with this fix is 
pending.
   


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