mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-14 05:07:48 +00:00
fix lease interval value set (#184)
* fix lease interval value set Signed-off-by: champly <champly@outlook.com> * remove managedcluster leasedurationsecondes value set Signed-off-by: champly <champly@outlook.com>
This commit is contained in:
@@ -26,6 +26,11 @@ import (
|
||||
|
||||
const leaseDurationTimes = 5
|
||||
|
||||
var (
|
||||
// LeaseDurationSeconds is lease update time interval
|
||||
LeaseDurationSeconds = 60
|
||||
)
|
||||
|
||||
// leaseController checks the lease of managed clusters on hub cluster to determine whether a managed cluster is available.
|
||||
type leaseController struct {
|
||||
kubeClient kubernetes.Interface
|
||||
@@ -95,6 +100,10 @@ func (c *leaseController) sync(ctx context.Context, syncCtx factory.SyncContext)
|
||||
return err
|
||||
case err == nil:
|
||||
gracePeriod := time.Duration(leaseDurationTimes*cluster.Spec.LeaseDurationSeconds) * time.Second
|
||||
// FIX: #183 avoid gracePeriod is zero, will non-stop update ManagedClusterLeaseUpdateStopped condition.
|
||||
if gracePeriod == 0 {
|
||||
gracePeriod = time.Duration(leaseDurationTimes*LeaseDurationSeconds) * time.Second
|
||||
}
|
||||
// the lease is constantly updated, do nothing
|
||||
now := time.Now()
|
||||
if now.Before(observedLease.Spec.RenewTime.Add(gracePeriod)) {
|
||||
|
||||
@@ -20,8 +20,10 @@ import (
|
||||
// well-known anonymous user
|
||||
const anonymous = "system:anonymous"
|
||||
|
||||
// CreatingControllerSyncInterval is exposed so that integration tests can crank up the controller sync speed.
|
||||
var CreatingControllerSyncInterval = 60 * time.Minute
|
||||
var (
|
||||
// CreatingControllerSyncInterval is exposed so that integration tests can crank up the controller sync speed.
|
||||
CreatingControllerSyncInterval = 60 * time.Minute
|
||||
)
|
||||
|
||||
// managedClusterCreatingController creates a ManagedCluster on hub cluster during the spoke agent bootstrap phase
|
||||
type managedClusterCreatingController struct {
|
||||
|
||||
Reference in New Issue
Block a user