Merge pull request #2033 from dddddai/lease

Skip updating lease for push mode clusters
This commit is contained in:
karmada-bot 2022-06-23 20:42:15 +08:00 committed by GitHub
commit 5fcdafbcfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -420,6 +420,10 @@ func (c *Controller) tryUpdateClusterHealth(ctx context.Context, cluster *cluste
}
}
if cluster.Spec.SyncMode == clusterv1alpha1.Push {
return observedReadyCondition, currentReadyCondition, nil
}
// Always update the probe time if cluster lease is renewed.
// Note: If cluster-status-controller never posted the cluster status, but continues renewing the
// heartbeat leases, the cluster controller will assume the cluster is healthy and take no action.

View File

@ -162,8 +162,10 @@ func (c *ClusterStatusController) syncClusterStatus(cluster *clusterv1alpha1.Clu
klog.Errorf("Failed to get or create informer for Cluster %s. Error: %v.", cluster.GetName(), err)
}
// init the lease controller for every cluster
c.initLeaseController(clusterInformerManager.Context(), cluster)
if cluster.Spec.SyncMode == clusterv1alpha1.Pull {
// init the lease controller for pull mode clusters
c.initLeaseController(clusterInformerManager.Context(), cluster)
}
clusterVersion, err := getKubernetesVersion(clusterClient)
if err != nil {