From 65551e46022949a9bf0c3027f80ca70a47ed7a84 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 11 Apr 2026 16:26:24 +0100 Subject: [PATCH] fix(dbaas): relax MySQL anti-affinity from required to preferred Avoids pods getting stuck Pending during node outages while still preferring to spread across nodes. --- stacks/dbaas/modules/dbaas/main.tf | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/stacks/dbaas/modules/dbaas/main.tf b/stacks/dbaas/modules/dbaas/main.tf index 0b125c5f..a762273d 100644 --- a/stacks/dbaas/modules/dbaas/main.tf +++ b/stacks/dbaas/modules/dbaas/main.tf @@ -265,17 +265,16 @@ resource "helm_release" "mysql_cluster" { } } podAntiAffinity = { - # Required anti-affinity: MySQL pods MUST be on different nodes. - # During node loss, one pod will be Pending — this is acceptable because - # InnoDB Cluster operates with 2/3 members (OK_NO_TOLERANCE). - # The descheduler (every 5 min) handles violations if any occur. - requiredDuringSchedulingIgnoredDuringExecution = [{ - labelSelector = { - matchLabels = { - "component" = "mysqld" + preferredDuringSchedulingIgnoredDuringExecution = [{ + weight = 100 + podAffinityTerm = { + labelSelector = { + matchLabels = { + "component" = "mysqld" + } } + topologyKey = "kubernetes.io/hostname" } - topologyKey = "kubernetes.io/hostname" }] } }