mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-14 05:25:33 +00:00
Change PingTime to be persistent
Kubernetes-commit: 0c774d0b1f79b0b0a6d73102a78c84853220f036
This commit is contained in:
parent
f45c45195a
commit
825f52e194
@ -103,7 +103,7 @@ func NewCandidate(clientset kubernetes.Interface,
|
||||
h, err := leaseCandidateInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||
if leasecandidate, ok := newObj.(*v1alpha1.LeaseCandidate); ok {
|
||||
if leasecandidate.Spec.PingTime != nil {
|
||||
if leasecandidate.Spec.PingTime != nil && leasecandidate.Spec.PingTime.After(leasecandidate.Spec.RenewTime.Time) {
|
||||
lc.enqueueLease()
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,6 @@ func (c *LeaseCandidate) ensureLease(ctx context.Context) error {
|
||||
klog.V(2).Infof("lease candidate exists. Renewing.")
|
||||
clone := lease.DeepCopy()
|
||||
clone.Spec.RenewTime = &metav1.MicroTime{Time: c.clock.Now()}
|
||||
clone.Spec.PingTime = nil
|
||||
_, err = c.leaseClient.Update(ctx, clone, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -130,7 +130,6 @@ func pollForLease(ctx context.Context, tc testcase, client *fake.Clientset, t *m
|
||||
if lc.Spec.BinaryVersion == tc.binaryVersion &&
|
||||
lc.Spec.EmulationVersion == tc.emulationVersion &&
|
||||
lc.Spec.LeaseName == tc.leaseName &&
|
||||
lc.Spec.PingTime == nil &&
|
||||
lc.Spec.RenewTime != nil {
|
||||
// Ensure that if a time is provided, the renewTime occurred after the provided time.
|
||||
if t != nil && t.After(lc.Spec.RenewTime.Time) {
|
||||
|
Loading…
Reference in New Issue
Block a user