Skip to content

Commit

Permalink
pkg/controller/node/nodecontroller: simplify mutex
Browse files Browse the repository at this point in the history
Similar to kubernetes#29598, we can rely on the zero-value construction behavior
to embed `sync.Mutex` into parent structs.
  • Loading branch information
matttproud committed Jul 26, 2016
1 parent ed3a29b commit 76aab29
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/controller/node/nodecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type NodeController struct {
nodeStatusMap map[string]nodeStatusData
now func() unversioned.Time
// Lock to access evictor workers
evictorLock *sync.Mutex
evictorLock sync.Mutex
// workers that evicts pods from unresponsive nodes.
zonePodEvictor map[string]*RateLimitedTimedQueue
zoneTerminationEvictor map[string]*RateLimitedTimedQueue
Expand Down Expand Up @@ -181,7 +181,6 @@ func NewNodeController(
glog.Fatal("NodeController: Invalid clusterCIDR, mask size of clusterCIDR must be less than nodeCIDRMaskSize.")
}
}
evictorLock := sync.Mutex{}

nc := &NodeController{
cloud: cloud,
Expand All @@ -190,7 +189,6 @@ func NewNodeController(
recorder: recorder,
podEvictionTimeout: podEvictionTimeout,
maximumGracePeriod: 5 * time.Minute,
evictorLock: &evictorLock,
zonePodEvictor: make(map[string]*RateLimitedTimedQueue),
zoneTerminationEvictor: make(map[string]*RateLimitedTimedQueue),
nodeStatusMap: make(map[string]nodeStatusData),
Expand Down

0 comments on commit 76aab29

Please sign in to comment.