Skip to content

Commit

Permalink
issue-747: Add a finalizer to the MySQLCluster's pods.
Browse files Browse the repository at this point in the history
  • Loading branch information
shunki-fujita committed Oct 8, 2024
1 parent 9e10394 commit 4042238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/mysqlcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ func (r *MySQLClusterReconciler) reconcileV1StatefulSet(ctx context.Context, req
sts.Spec.WithTemplate(corev1ac.PodTemplateSpec().
WithAnnotations(cluster.Spec.PodTemplate.Annotations).
WithLabels(cluster.Spec.PodTemplate.Labels).
WithLabels(labelSet(cluster, false)))
WithLabels(labelSet(cluster, false)).
WithFinalizers(constants.MySQLClusterPodFinalizer))

podSpec := corev1ac.PodSpecApplyConfiguration(*cluster.Spec.PodTemplate.Spec.DeepCopy())
podSpec.WithServiceAccountName(cluster.PrefixedName())
Expand Down
3 changes: 3 additions & 0 deletions pkg/constants/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ const (

// MySQLClusterFinalizer is the finalizer specifier for MySQLCluster.
const MySQLClusterFinalizer = "moco.cybozu.com/mysqlcluster"

// MySQLClusterPodFinalizer is the finalizer specifier for MySQLCluster's pods.
const MySQLClusterPodFinalizer = "moco.cybozu.com/mysqlcluster-pod"

0 comments on commit 4042238

Please sign in to comment.