[release-3.3] controller/cluster: retry when updating the KubeFedCluster conflicted (#5655)

controller/cluster: retry when updating the KubeFedCluster conflicted
This commit is contained in:
Xinzhao Xu
2023-04-26 10:22:28 +08:00
committed by GitHub
parent 01b45542b4
commit 8b5488ffa9
2 changed files with 16 additions and 10 deletions

View File

@@ -407,6 +407,11 @@ func (c *clusterController) syncCluster(key string) error {
} else { // join federation
_, err = c.joinFederation(clusterConfig, cluster.Name, cluster.Labels)
if err != nil {
if errors.IsConflict(err) {
klog.Warningf("update KubeFedCluster %s conflicted, retrying", cluster.Name)
return err
}
klog.Errorf("Failed to join federation for cluster %s, error %v", cluster.Name, err)
federationNotReadyCondition := clusterv1alpha1.ClusterCondition{