mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	change node-lease-renew-interval to 0.25 of renew-duration
0.25 is a dedicated value to align before default value of renew-interval but get more heuristic interval
This commit is contained in:
		@@ -872,7 +872,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
 | 
				
			|||||||
	klet.softAdmitHandlers.AddPodAdmitHandler(lifecycle.NewNoNewPrivsAdmitHandler(klet.containerRuntime))
 | 
						klet.softAdmitHandlers.AddPodAdmitHandler(lifecycle.NewNoNewPrivsAdmitHandler(klet.containerRuntime))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if utilfeature.DefaultFeatureGate.Enabled(features.NodeLease) {
 | 
						if utilfeature.DefaultFeatureGate.Enabled(features.NodeLease) {
 | 
				
			||||||
		klet.nodeLeaseController = nodelease.NewController(klet.clock, klet.heartbeatClient, string(klet.nodeName), kubeCfg.NodeLeaseDurationSeconds, kubeCfg.NodeStatusUpdateFrequency.Duration, klet.onRepeatedHeartbeatFailure)
 | 
							klet.nodeLeaseController = nodelease.NewController(klet.clock, klet.heartbeatClient, string(klet.nodeName), kubeCfg.NodeLeaseDurationSeconds, klet.onRepeatedHeartbeatFailure)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	klet.softAdmitHandlers.AddPodAdmitHandler(lifecycle.NewProcMountAdmitHandler(klet.containerRuntime))
 | 
						klet.softAdmitHandlers.AddPodAdmitHandler(lifecycle.NewProcMountAdmitHandler(klet.containerRuntime))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,8 +34,8 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	// defaultRenewInterval is the default interval at which the lease is renewed
 | 
						// renewIntervalFraction is the fraction of lease duration to renew the lease
 | 
				
			||||||
	defaultRenewInterval = 10 * time.Second
 | 
						renewIntervalFraction = 0.25
 | 
				
			||||||
	// maxUpdateRetries is the number of immediate, successive retries the Kubelet will attempt
 | 
						// maxUpdateRetries is the number of immediate, successive retries the Kubelet will attempt
 | 
				
			||||||
	// when renewing the lease before it waits for the renewal interval before trying again,
 | 
						// when renewing the lease before it waits for the renewal interval before trying again,
 | 
				
			||||||
	// similar to what we do for node status retries
 | 
						// similar to what we do for node status retries
 | 
				
			||||||
@@ -60,27 +60,18 @@ type controller struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NewController constructs and returns a controller
 | 
					// NewController constructs and returns a controller
 | 
				
			||||||
func NewController(clock clock.Clock, client clientset.Interface, holderIdentity string, leaseDurationSeconds int32, nodeStatusUpdateFrequency time.Duration, onRepeatedHeartbeatFailure func()) Controller {
 | 
					func NewController(clock clock.Clock, client clientset.Interface, holderIdentity string, leaseDurationSeconds int32, onRepeatedHeartbeatFailure func()) Controller {
 | 
				
			||||||
	var leaseClient coordclientset.LeaseInterface
 | 
						var leaseClient coordclientset.LeaseInterface
 | 
				
			||||||
	if client != nil {
 | 
						if client != nil {
 | 
				
			||||||
		leaseClient = client.CoordinationV1().Leases(corev1.NamespaceNodeLease)
 | 
							leaseClient = client.CoordinationV1().Leases(corev1.NamespaceNodeLease)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	renewInterval := defaultRenewInterval
 | 
						leaseDuration := time.Duration(leaseDurationSeconds) * time.Second
 | 
				
			||||||
	// Users are able to decrease the timeout after which nodes are being
 | 
					 | 
				
			||||||
	// marked as "Ready: Unknown" by NodeLifecycleController to values
 | 
					 | 
				
			||||||
	// smaller than defaultRenewInterval. Until the knob to configure
 | 
					 | 
				
			||||||
	// lease renew interval is exposed to user, we temporarily decrease
 | 
					 | 
				
			||||||
	// renewInterval based on the NodeStatusUpdateFrequency.
 | 
					 | 
				
			||||||
	if renewInterval > nodeStatusUpdateFrequency {
 | 
					 | 
				
			||||||
		renewInterval = nodeStatusUpdateFrequency
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return &controller{
 | 
						return &controller{
 | 
				
			||||||
		client:                     client,
 | 
							client:                     client,
 | 
				
			||||||
		leaseClient:                leaseClient,
 | 
							leaseClient:                leaseClient,
 | 
				
			||||||
		holderIdentity:             holderIdentity,
 | 
							holderIdentity:             holderIdentity,
 | 
				
			||||||
		leaseDurationSeconds:       leaseDurationSeconds,
 | 
							leaseDurationSeconds:       leaseDurationSeconds,
 | 
				
			||||||
		renewInterval:              renewInterval,
 | 
							renewInterval:              time.Duration(float64(leaseDuration) * renewIntervalFraction),
 | 
				
			||||||
		clock:                      clock,
 | 
							clock:                      clock,
 | 
				
			||||||
		onRepeatedHeartbeatFailure: onRepeatedHeartbeatFailure,
 | 
							onRepeatedHeartbeatFailure: onRepeatedHeartbeatFailure,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user