Skip to content

Commit

Permalink
fix the RO readness check
Browse files Browse the repository at this point in the history
  • Loading branch information
acekingke committed Nov 25, 2024
1 parent 392e153 commit ddcc129
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mysqlcluster/syncer/readonly_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,23 @@ func GetReadonlyStatefulSet(cr *StatefulSetSyncer) (*appsv1.StatefulSet, error)
}

mysql := container.EnsureContainer(utils.ContainerMysqlName, cr.MysqlCluster)
// ReadOnly mysql cannot use the mysqlchecker to do readness check
mysql.ReadinessProbe = &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Exec: &corev1.ExecAction{
Command: []string{
"sh",
"-c",
`if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; test $(mysql -uroot -NB -e "SELECT 1") -eq 1`,
},
},
},
InitialDelaySeconds: 10,
TimeoutSeconds: 15,
PeriodSeconds: 15,
SuccessThreshold: 1,
FailureThreshold: 3,
}
if cr.Spec.ReadOnlys.Resources != nil {
mysql.Resources = *cr.Spec.ReadOnlys.Resources
// (RO) calc innodb buffer and add it to env
Expand Down

0 comments on commit ddcc129

Please sign in to comment.