@@ -34,8 +34,8 @@ import (
34
34
)
35
35
36
36
const (
37
- // renewInterval is the interval at which the lease is renewed
38
- renewInterval = 10 * time .Second
37
+ // defaultRenewInterval is the default interval at which the lease is renewed
38
+ defaultRenewInterval = 10 * time .Second
39
39
// maxUpdateRetries is the number of immediate, successive retries the Kubelet will attempt
40
40
// when renewing the lease before it waits for the renewal interval before trying again,
41
41
// similar to what we do for node status retries
@@ -60,11 +60,21 @@ type controller struct {
60
60
}
61
61
62
62
// NewController constructs and returns a controller
63
- func NewController (clock clock.Clock , client clientset.Interface , holderIdentity string , leaseDurationSeconds int32 , onRepeatedHeartbeatFailure func ()) Controller {
63
+ func NewController (clock clock.Clock , client clientset.Interface , holderIdentity string , leaseDurationSeconds int32 , nodeStatusUpdateFrequency time. Duration , onRepeatedHeartbeatFailure func ()) Controller {
64
64
var leaseClient coordclientset.LeaseInterface
65
65
if client != nil {
66
66
leaseClient = client .CoordinationV1 ().Leases (corev1 .NamespaceNodeLease )
67
67
}
68
+ renewInterval := defaultRenewInterval
69
+ // Users are able to decrease the timeout after which nodes are being
70
+ // marked as "Ready: Unknown" by NodeLifecycleController to values
71
+ // smaller than defaultRenewInterval. Until the knob to configure
72
+ // lease renew interval is exposed to user, we temporarily decrease
73
+ // renewInterval based on the NodeStatusUpdateFrequency.
74
+ if renewInterval > nodeStatusUpdateFrequency {
75
+ renewInterval = nodeStatusUpdateFrequency
76
+ }
77
+
68
78
return & controller {
69
79
client : client ,
70
80
leaseClient : leaseClient ,
0 commit comments