Skip to content

Commit

Permalink
PWX-35004 : Retry to update storagecluster status if it fails (#1370) (
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-bhatia authored Dec 6, 2023
1 parent bbf86b4 commit 751b3ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/controller/storagecluster/storagecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1686,10 +1686,12 @@ func (c *Controller) setStorageClusterDefaults(cluster *corev1.StorageCluster) e
}

// NOTE: race condition can happen when updating status right after spec,
// revision got from live cluster can become stale, so ignoring the error in syncStorageCluster
cluster.Status = *toUpdate.Status.DeepCopy()
if err := k8s.UpdateStorageClusterStatus(c.client, cluster); err != nil {
return err
logrus.Errorf("error updating status for %s/%s trying again...", cluster.Namespace, cluster.Name)
if err := k8s.UpdateStorageClusterStatus(c.client, cluster); err != nil {
return fmt.Errorf("update storage cluster status failure, %v", err)
}
}
}
return nil
Expand Down

0 comments on commit 751b3ac

Please sign in to comment.