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 19, 2023
1 parent 9a73382 commit 710d95a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/controllers/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ func (cc *ClusterReconciler) sync(c *scyllav1.ScyllaCluster) error {
}
logger.Debug(ctx, "All StatefulSets are up-to-date!")

// Cleanup Cluster resources
/*// 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 {
Expand All @@ -68,6 +68,12 @@ func (cc *ClusterReconciler) sync(c *scyllav1.ScyllaCluster) error {
return errors.Wrap(err, "failed to sync member service")
}

// Criteo: moved from before "Sync Headless Service for Cluster" to here
// 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 710d95a

Please sign in to comment.