mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-10 11:19:11 +00:00
Merge pull request #78 from skeeey/backward-compatible
rollback LeaseDurationSeconds code for backward compatible
This commit is contained in:
@@ -93,6 +93,11 @@ func (c *leaseController) sync(ctx context.Context, syncCtx factory.SyncContext)
|
||||
}
|
||||
|
||||
leaseDurationSeconds := cluster.Spec.LeaseDurationSeconds
|
||||
// for backward compatible, release-2.1 has mutating admission webhook to mutate this field,
|
||||
// but release-2.0 does not have the mutating admission webhook
|
||||
if leaseDurationSeconds == 0 {
|
||||
leaseDurationSeconds = 60
|
||||
}
|
||||
|
||||
gracePeriod := time.Duration(leaseDurationTimes*leaseDurationSeconds) * time.Second
|
||||
// the lease is constantly updated, do nothing
|
||||
|
||||
@@ -70,6 +70,11 @@ func (c *managedClusterLeaseController) sync(ctx context.Context, syncCtx factor
|
||||
}
|
||||
|
||||
observedLeaseDurationSeconds := cluster.Spec.LeaseDurationSeconds
|
||||
// for backward compatible, release-2.1 has mutating admission webhook to mutate this field,
|
||||
// but release-2.0 does not have the mutating admission webhook
|
||||
if observedLeaseDurationSeconds == 0 {
|
||||
observedLeaseDurationSeconds = 60
|
||||
}
|
||||
|
||||
// if lease duration is changed, start a new lease update routine.
|
||||
if c.lastLeaseDurationSeconds != observedLeaseDurationSeconds {
|
||||
|
||||
Reference in New Issue
Block a user