mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
pkg/controller/node/nodecontroller: simplify mutex
Similar to #29598, we can rely on the zero-value construction behavior to embed `sync.Mutex` into parent structs.
This commit is contained in:
parent
ed3a29bd6a
commit
76aab29ede
@ -114,7 +114,7 @@ type NodeController struct {
|
|||||||
nodeStatusMap map[string]nodeStatusData
|
nodeStatusMap map[string]nodeStatusData
|
||||||
now func() unversioned.Time
|
now func() unversioned.Time
|
||||||
// Lock to access evictor workers
|
// Lock to access evictor workers
|
||||||
evictorLock *sync.Mutex
|
evictorLock sync.Mutex
|
||||||
// workers that evicts pods from unresponsive nodes.
|
// workers that evicts pods from unresponsive nodes.
|
||||||
zonePodEvictor map[string]*RateLimitedTimedQueue
|
zonePodEvictor map[string]*RateLimitedTimedQueue
|
||||||
zoneTerminationEvictor map[string]*RateLimitedTimedQueue
|
zoneTerminationEvictor map[string]*RateLimitedTimedQueue
|
||||||
@ -181,7 +181,6 @@ func NewNodeController(
|
|||||||
glog.Fatal("NodeController: Invalid clusterCIDR, mask size of clusterCIDR must be less than nodeCIDRMaskSize.")
|
glog.Fatal("NodeController: Invalid clusterCIDR, mask size of clusterCIDR must be less than nodeCIDRMaskSize.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
evictorLock := sync.Mutex{}
|
|
||||||
|
|
||||||
nc := &NodeController{
|
nc := &NodeController{
|
||||||
cloud: cloud,
|
cloud: cloud,
|
||||||
@ -190,7 +189,6 @@ func NewNodeController(
|
|||||||
recorder: recorder,
|
recorder: recorder,
|
||||||
podEvictionTimeout: podEvictionTimeout,
|
podEvictionTimeout: podEvictionTimeout,
|
||||||
maximumGracePeriod: 5 * time.Minute,
|
maximumGracePeriod: 5 * time.Minute,
|
||||||
evictorLock: &evictorLock,
|
|
||||||
zonePodEvictor: make(map[string]*RateLimitedTimedQueue),
|
zonePodEvictor: make(map[string]*RateLimitedTimedQueue),
|
||||||
zoneTerminationEvictor: make(map[string]*RateLimitedTimedQueue),
|
zoneTerminationEvictor: make(map[string]*RateLimitedTimedQueue),
|
||||||
nodeStatusMap: make(map[string]nodeStatusData),
|
nodeStatusMap: make(map[string]nodeStatusData),
|
||||||
|
Loading…
Reference in New Issue
Block a user