mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 12:16:03 +09:00
The masters only prefer separate nodes, which decides where they start but not where a drain puts them back. On a three-node cluster both other nodes already run a master when one is evicted, so the replacement starts next to one of them and stays there after the drained node returns. Nothing moves it back, and losing that node then takes two of the three raft members and the quorum with them. A hostname spread with DoNotSchedule and maxSkew 1 keeps counting the cordoned node, which now runs no master, as the minimum. The replacement waits Pending for it and starts there once it is uncordoned, while the other two masters keep quorum. Unlike the required anti-affinity of the upstream chart it still lets two nodes run two and one masters and a single node all three, since the skew is measured between the nodes that exist. nodeTaintsPolicy stays Ignore because a cordoned node carries the unschedulable taint and Honor would drop it from the count. The cost is that a node the masters never run on counts as well, so next to a tainted control plane they need three nodes they can use, or the third one stays Pending. The soft anti-affinity stays for scoring. Where three nodes can take the masters, the rolling update this causes also separates masters that already share a node. Set master.topologySpreadPolicy to soft on clusters where a tainted node would otherwise keep a master Pending. Soft clears the hard constraint and leaves the preferred anti-affinity in place. The chart tests cover the default, soft and invalid policies. Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>