Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mysqlcluster/container/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ func (c *mysql) getLivenessProbe() *corev1.Probe {
Command: []string{
"sh",
"-c",
"if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; pgrep mysqld",
"if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; " +
"touch /var/lib/mysql/auto.cnf && pgrep mysqld",
},
},
},
Expand All @@ -116,6 +117,9 @@ func (c *mysql) getReadinessProbe() *corev1.Probe {
return &corev1.Probe{
Handler: corev1.Handler{
Exec: &corev1.ExecAction{
/* /var/lib/mysql/sleep-forever is used to prevent mysql's container from exiting.
kubectl exec -it sample-mysql-0 -c mysql -- sh -c 'touch /var/lib/mysql/sleep-forever'
*/
Command: []string{
"sh",
"-c",
Expand Down
2 changes: 1 addition & 1 deletion mysqlcluster/container/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestGetMysqlLivenessProbe(t *testing.T) {
livenessProbe := &corev1.Probe{
Handler: corev1.Handler{
Exec: &corev1.ExecAction{
Command: []string{"sh", "-c", "if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; pgrep mysqld"},
Command: []string{"sh", "-c", "if [ -f '/var/lib/mysql/sleep-forever' ] ;then exit 0 ; fi; touch /var/lib/mysql/auto.cnf && pgrep mysqld"},
},
},
InitialDelaySeconds: 30,
Expand Down