Skip to content

Commit

Permalink
sync: attempt to fix race condition between pod/service deletion
Browse files Browse the repository at this point in the history
If the pod isn't yet deleted when deleting its associated PVC and
service, scylla-operator could erroneously recreate the service.
  • Loading branch information
eappere committed Sep 14, 2023
1 parent 9a73382 commit 0632b6a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/controllers/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ func (cc *ClusterReconciler) sync(c *scyllav1.ScyllaCluster) error {
}
logger.Debug(ctx, "All StatefulSets are up-to-date!")

// Cleanup Cluster resources
if err := cc.cleanup(ctx, c); err != nil {
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, MessageCleanupFailed)
}

// Sync Headless Service for Cluster
if err := cc.syncClusterHeadlessService(ctx, c); err != nil {
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, MessageHeadlessServiceSyncFailed)
Expand All @@ -68,6 +63,11 @@ func (cc *ClusterReconciler) sync(c *scyllav1.ScyllaCluster) error {
return errors.Wrap(err, "failed to sync member service")
}

// Cleanup Cluster resources
if err := cc.cleanup(ctx, c); err != nil {
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, MessageCleanupFailed)
}

// Update Status
logger.Info(ctx, "Calculating cluster status...")
if err := cc.updateStatus(ctx, c); err != nil {
Expand Down

0 comments on commit 0632b6a

Please sign in to comment.