[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:
parent
1101242036
commit
c07870d068
1 changed files with 8 additions and 5 deletions
|
|
@ -121,21 +121,24 @@ resource "helm_release" "mysql_cluster" {
|
||||||
depends_on = [helm_release.mysql_operator]
|
depends_on = [helm_release.mysql_operator]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compatibility service: mysql.dbaas points at InnoDB Cluster Router
|
# Compatibility service: mysql.dbaas points at InnoDB Cluster mysqld pods
|
||||||
# Router handles automatic failover — clients connect here transparently
|
# 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" {
|
resource "kubernetes_service" "mysql" {
|
||||||
metadata {
|
metadata {
|
||||||
name = var.cluster_master_service
|
name = var.cluster_master_service
|
||||||
namespace = kubernetes_namespace.dbaas.metadata[0].name
|
namespace = kubernetes_namespace.dbaas.metadata[0].name
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
|
publish_not_ready_addresses = true # bypass InnoDB Cluster readiness gate during partial failures
|
||||||
selector = {
|
selector = {
|
||||||
"component" = "mysqlrouter"
|
"component" = "mysqld"
|
||||||
"mysql.oracle.com/cluster" = "mysql-cluster"
|
"mysql.oracle.com/cluster" = "mysql-cluster"
|
||||||
|
"statefulset.kubernetes.io/pod-name" = "mysql-cluster-1" # pin to healthy primary until cluster recovers
|
||||||
}
|
}
|
||||||
port {
|
port {
|
||||||
port = 3306
|
port = 3306
|
||||||
target_port = 6446
|
target_port = 3306
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue