Merge pull request #78 from skeeey/backward-compatible

rollback LeaseDurationSeconds code for backward compatible
This commit is contained in:
OpenShift Merge Robot
2020-09-22 02:41:00 -04:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -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

View File

@@ -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 {