cybozu-go / moco

MySQL operator on Kubernetes using GTID-based semi-synchronous replication.
https://cybozu-go.github.io/moco/
Apache License 2.0
277 stars 22 forks source link

Terminate MySQL container faster when probe fails #361

Open morimoto-cybozu opened 2 years ago

morimoto-cybozu commented 2 years ago

What

MOCO configures .spec.template.spec.terminationGracePeriodSeconds of a MySQL StatefulSet to 300 by default. This is good for ordinary termination, but too long for abnormal termination caused by probe failure.

The per-probe terminationGracePeriodSeconds introduced in K8s 1.21 would be useful for abnormal termination.

Note that this property is available only if the Feature Gate ProbeTerminationGracePeriod is enabled. If the Feature Gate is disabled, the property is accepted in Create/Update but not returned in Get requests. To avoid infinite reconciliation retries, the MOCO controller should provide a configuration method to enable/disable per-probe terminationGracePeriodSeconds.

The ProbeTerminationGracePeriod feature gate became beta in Kubernetes 1.22. After we drop supports for Kubernetes 1.21 and prior versions, we may use this feature unconditionally.

How

Describe how to address the issue.

Checklist

d-kuro commented 2 years ago

@morimoto-cybozu Now available in moco v0.13.0. https://github.com/cybozu-go/moco/blob/v0.13.0/config/crd/bases/moco.cybozu.com_mysqlclusters.yaml#L916

morimoto-cybozu commented 2 years ago

@d-kuro That line is a part of .spec.podTemplate of the MySQLCluster CRD, so it means that the users of MOCO can configure the per-probe terminationGracePeriodSeconds manually by themselves. It would be good if the MOCO controller configures the per-probe terminationGracePeriodSeconds as it does for the per-pod one. https://github.com/cybozu-go/moco/blob/v0.13.0/controllers/mysqlcluster_controller.go#L819