Skip to content

Commit ddcc129

Browse files
committed
fix the RO readness check
1 parent 392e153 commit ddcc129

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mysqlcluster/syncer/readonly_statefulset.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@ func GetReadonlyStatefulSet(cr *StatefulSetSyncer) (*appsv1.StatefulSet, error)
167167
}
168168

169169
mysql := container.EnsureContainer(utils.ContainerMysqlName, cr.MysqlCluster)
170+
// ReadOnly mysql cannot use the mysqlchecker to do readness check
171+
mysql.ReadinessProbe = &corev1.Probe{
172+
ProbeHandler: corev1.ProbeHandler{
173+
Exec: &corev1.ExecAction{
174+
Command: []string{
175+
"sh",
176+
"-c",
177+
`if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; test $(mysql -uroot -NB -e "SELECT 1") -eq 1`,
178+
},
179+
},
180+
},
181+
InitialDelaySeconds: 10,
182+
TimeoutSeconds: 15,
183+
PeriodSeconds: 15,
184+
SuccessThreshold: 1,
185+
FailureThreshold: 3,
186+
}
170187
if cr.Spec.ReadOnlys.Resources != nil {
171188
mysql.Resources = *cr.Spec.ReadOnlys.Resources
172189
// (RO) calc innodb buffer and add it to env

0 commit comments

Comments
 (0)