[ci skip] fix MySQL service: point at mysqld pods, pin to healthy primary

The InnoDB Cluster Router (mysqlrouter) doesn't deploy when the cluster
lacks quorum. Changed service selector from mysqlrouter to mysqld with
publishNotReadyAddresses=true to bypass the operator's readiness gate.
Pinned to mysql-cluster-1 (healthy primary) until full cluster recovers.
This commit is contained in:
Viktor Barzin 2026-03-01 12:16:28 +00:00
parent 1101242036
commit c07870d068

View file

@ -121,21 +121,24 @@ resource "helm_release" "mysql_cluster" {
depends_on = [helm_release.mysql_operator]
}
# Compatibility service: mysql.dbaas points at InnoDB Cluster Router
# Router handles automatic failover clients connect here transparently
# Compatibility service: mysql.dbaas points at InnoDB Cluster mysqld pods
# When router is available it handles failover, but we fall back to direct
# mysqld access to avoid total outage during partial cluster failures
resource "kubernetes_service" "mysql" {
metadata {
name = var.cluster_master_service
namespace = kubernetes_namespace.dbaas.metadata[0].name
}
spec {
publish_not_ready_addresses = true # bypass InnoDB Cluster readiness gate during partial failures
selector = {
"component" = "mysqlrouter"
"mysql.oracle.com/cluster" = "mysql-cluster"
"component" = "mysqld"
"mysql.oracle.com/cluster" = "mysql-cluster"
"statefulset.kubernetes.io/pod-name" = "mysql-cluster-1" # pin to healthy primary until cluster recovers
}
port {
port = 3306
target_port = 6446
target_port = 3306
}
}