Node promotion for topology label

  • Related issues: #2325 [FEATURE] Harvester control plane should spread across failure domains

Category:

  • Host

Verification Steps

  1. Install first node, the role of this node should be Management Node
  2. Install second node, the role of this node should be Compute Node, the second node shouldn’t be promoted to Management Node
  3. Add label topology.kubernetes.io/zone=zone1 to the first node
  4. Install third node, the second node and third node shouldn’t be promoted
  5. Add label topology.kubernetes.io/zone=zone1 to the second node, the second node and third node shouldn’t be promoted
  6. Add label topology.kubernetes.io/zone=zone3 to the third node, the second node and third node shouldn’t be promoted
  7. Change the value of label topology.kubernetes.io/zone from zone1 to zone2 in the second node, the second node and third node will be promoted to Management Node one by one

Expected Results

Checked can pass the following test scenarios.

  1. Install first node, the role of this node should be Management Node

    harv-0715-node1:~ # kubectl get nodes
    NAME              STATUS   ROLES                       AGE     VERSION
    harv-0715-node1   Ready    control-plane,etcd,master   8m19s   v1.21.11+rke2r1
    
  2. Install second node, the role of this node should be Compute Node, the second node shouldn’t be promoted to Management Node

    harv-0715-node1:~ # kubectl get nodes
    NAME              STATUS   ROLES                       AGE   VERSION
    harv-0715-node1   Ready    control-plane,etcd,master   30m   v1.21.11+rke2r1
    harv-0715-node2   Ready    <none>                      84s   v1.21.11+rke2r1
    
  3. Add label topology.kubernetes.io/zone=zone1 to the first node image

  4. Install third node, the second node and third node shouldn’t be promoted

    harv-0715-node1:~ # kubectl get nodes
    NAME              STATUS   ROLES                       AGE   VERSION
    harv-0715-node1   Ready    control-plane,etcd,master   74m   v1.21.11+rke2r1
    harv-0715-node2   Ready    <none>                      45m   v1.21.11+rke2r1
    harv-0715-node3   Ready    <none>                      29m   v1.21.11+rke2r1
    
  5. Add label topology.kubernetes.io/zone=zone1 to the second node, the second node and third node shouldn’t be promoted The second node have automatically add topology.kubernetes.io/zone=zone1 after joining the cluster image

  6. Add label topology.kubernetes.io/zone=zone3 to the third node, the second node and third node shouldn’t be promoted image

    NAME              STATUS   ROLES                       AGE   VERSION
    harv-0715-node1   Ready    control-plane,etcd,master   88m   v1.21.11+rke2r1
    harv-0715-node2   Ready    <none>                      59m   v1.21.11+rke2r1
    harv-0715-node3   Ready    <none>                      43m   v1.21.11+rke2r1
    
  7. Change the value of label topology.kubernetes.io/zone from zone1 to zone2 in the second node, the second node and third node will be promoted to Management Node one by one

  8. Second node set to zone2 image

  9. Second node cordened and promoted image

  10. Third node cordened and promoted image

  11. All nodes are promoted to the Mangement node

    harv-0715-node1:~ # kubectl get nodes
    NAME              STATUS   ROLES                       AGE   VERSION
    harv-0715-node1   Ready    control-plane,etcd,master   93m   v1.21.11+rke2r1
    harv-0715-node2   Ready    control-plane,etcd,master   64m   v1.21.11+rke2r1
    harv-0715-node3   Ready    control-plane,etcd,master   48m   v1.21.11+rke2r1