mirror of https://github.com/k3s-io/k3s
Merge pull request #49870 from k82cn/nc_rename_zone_tainer
Automatic merge from submit-queue (batch tested with PRs 49870, 49416, 49872, 49892, 49908) Renamed zoneNotReadyOrUnreachableTainer to zoneNoExecuteTainer. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: partially fixes #42001 **Release note**: ```release-note None ```pull/6/head
commit
455d85a984
|
@ -152,7 +152,7 @@ type NodeController struct {
|
|||
// workers that evicts pods from unresponsive nodes.
|
||||
zonePodEvictor map[string]*RateLimitedTimedQueue
|
||||
// workers that are responsible for tainting nodes.
|
||||
zoneNotReadyOrUnreachableTainer map[string]*RateLimitedTimedQueue
|
||||
zoneNoExecuteTainer map[string]*RateLimitedTimedQueue
|
||||
podEvictionTimeout time.Duration
|
||||
// The maximum duration before a pod evicted from a node can be forcefully terminated.
|
||||
maximumGracePeriod time.Duration
|
||||
|
@ -248,7 +248,7 @@ func NewNodeController(
|
|||
podEvictionTimeout: podEvictionTimeout,
|
||||
maximumGracePeriod: 5 * time.Minute,
|
||||
zonePodEvictor: make(map[string]*RateLimitedTimedQueue),
|
||||
zoneNotReadyOrUnreachableTainer: make(map[string]*RateLimitedTimedQueue),
|
||||
zoneNoExecuteTainer: make(map[string]*RateLimitedTimedQueue),
|
||||
nodeStatusMap: make(map[string]nodeStatusData),
|
||||
nodeMonitorGracePeriod: nodeMonitorGracePeriod,
|
||||
nodeMonitorPeriod: nodeMonitorPeriod,
|
||||
|
@ -434,12 +434,12 @@ func (nc *NodeController) doEvictionPass() {
|
|||
}
|
||||
}
|
||||
|
||||
func (nc *NodeController) doTaintingPass() {
|
||||
func (nc *NodeController) doNoExecuteTaintingPass() {
|
||||
nc.evictorLock.Lock()
|
||||
defer nc.evictorLock.Unlock()
|
||||
for k := range nc.zoneNotReadyOrUnreachableTainer {
|
||||
for k := range nc.zoneNoExecuteTainer {
|
||||
// Function should return 'false' and a time after which it should be retried, or 'true' if it shouldn't (it succeeded).
|
||||
nc.zoneNotReadyOrUnreachableTainer[k].Try(func(value TimedValue) (bool, time.Duration) {
|
||||
nc.zoneNoExecuteTainer[k].Try(func(value TimedValue) (bool, time.Duration) {
|
||||
node, err := nc.nodeLister.Get(value.Value)
|
||||
if apierrors.IsNotFound(err) {
|
||||
glog.Warningf("Node %v no longer present in nodeLister!", value.Value)
|
||||
|
@ -498,7 +498,7 @@ func (nc *NodeController) Run(stopCh <-chan struct{}) {
|
|||
if nc.useTaintBasedEvictions {
|
||||
// Handling taint based evictions. Because we don't want a dedicated logic in TaintManager for NC-originated
|
||||
// taints and we normally don't rate limit evictions caused by taints, we need to rate limit adding taints.
|
||||
go wait.Until(nc.doTaintingPass, nodeEvictionPeriod, wait.NeverStop)
|
||||
go wait.Until(nc.doNoExecuteTaintingPass, nodeEvictionPeriod, wait.NeverStop)
|
||||
} else {
|
||||
// Managing eviction of nodes:
|
||||
// When we delete pods off a node, if the node was not empty at the time we then
|
||||
|
@ -519,7 +519,7 @@ func (nc *NodeController) addPodEvictorForNewZone(node *v1.Node) {
|
|||
NewRateLimitedTimedQueue(
|
||||
flowcontrol.NewTokenBucketRateLimiter(nc.evictionLimiterQPS, evictionRateLimiterBurst))
|
||||
} else {
|
||||
nc.zoneNotReadyOrUnreachableTainer[zone] =
|
||||
nc.zoneNoExecuteTainer[zone] =
|
||||
NewRateLimitedTimedQueue(
|
||||
flowcontrol.NewTokenBucketRateLimiter(nc.evictionLimiterQPS, evictionRateLimiterBurst))
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ func (nc *NodeController) handleDisruption(zoneToNodeConditions map[string][]*v1
|
|||
// We stop all evictions.
|
||||
for k := range nc.zoneStates {
|
||||
if nc.useTaintBasedEvictions {
|
||||
nc.zoneNotReadyOrUnreachableTainer[k].SwapLimiter(0)
|
||||
nc.zoneNoExecuteTainer[k].SwapLimiter(0)
|
||||
} else {
|
||||
nc.zonePodEvictor[k].SwapLimiter(0)
|
||||
}
|
||||
|
@ -809,13 +809,13 @@ func (nc *NodeController) setLimiterInZone(zone string, zoneSize int, state zone
|
|||
switch state {
|
||||
case stateNormal:
|
||||
if nc.useTaintBasedEvictions {
|
||||
nc.zoneNotReadyOrUnreachableTainer[zone].SwapLimiter(nc.evictionLimiterQPS)
|
||||
nc.zoneNoExecuteTainer[zone].SwapLimiter(nc.evictionLimiterQPS)
|
||||
} else {
|
||||
nc.zonePodEvictor[zone].SwapLimiter(nc.evictionLimiterQPS)
|
||||
}
|
||||
case statePartialDisruption:
|
||||
if nc.useTaintBasedEvictions {
|
||||
nc.zoneNotReadyOrUnreachableTainer[zone].SwapLimiter(
|
||||
nc.zoneNoExecuteTainer[zone].SwapLimiter(
|
||||
nc.enterPartialDisruptionFunc(zoneSize))
|
||||
} else {
|
||||
nc.zonePodEvictor[zone].SwapLimiter(
|
||||
|
@ -823,7 +823,7 @@ func (nc *NodeController) setLimiterInZone(zone string, zoneSize int, state zone
|
|||
}
|
||||
case stateFullDisruption:
|
||||
if nc.useTaintBasedEvictions {
|
||||
nc.zoneNotReadyOrUnreachableTainer[zone].SwapLimiter(
|
||||
nc.zoneNoExecuteTainer[zone].SwapLimiter(
|
||||
nc.enterFullDisruptionFunc(zoneSize))
|
||||
} else {
|
||||
nc.zonePodEvictor[zone].SwapLimiter(
|
||||
|
@ -1066,7 +1066,7 @@ func (nc *NodeController) evictPods(node *v1.Node) bool {
|
|||
func (nc *NodeController) markNodeForTainting(node *v1.Node) bool {
|
||||
nc.evictorLock.Lock()
|
||||
defer nc.evictorLock.Unlock()
|
||||
return nc.zoneNotReadyOrUnreachableTainer[utilnode.GetZoneKey(node)].Add(node.Name, string(node.UID))
|
||||
return nc.zoneNoExecuteTainer[utilnode.GetZoneKey(node)].Add(node.Name, string(node.UID))
|
||||
}
|
||||
|
||||
func (nc *NodeController) markNodeAsHealthy(node *v1.Node) (bool, error) {
|
||||
|
@ -1082,7 +1082,7 @@ func (nc *NodeController) markNodeAsHealthy(node *v1.Node) (bool, error) {
|
|||
glog.Errorf("Failed to remove taint from node %v: %v", node.Name, err)
|
||||
return false, err
|
||||
}
|
||||
return nc.zoneNotReadyOrUnreachableTainer[utilnode.GetZoneKey(node)].Remove(node.Name), nil
|
||||
return nc.zoneNoExecuteTainer[utilnode.GetZoneKey(node)].Remove(node.Name), nil
|
||||
}
|
||||
|
||||
// Default value for cluster eviction rate - we take nodeNum for consistency with ReducedQPSFunc.
|
||||
|
|
|
@ -2005,7 +2005,7 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
|
|||
if err := nodeController.monitorNodeStatus(); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
nodeController.doTaintingPass()
|
||||
nodeController.doNoExecuteTaintingPass()
|
||||
|
||||
node0, err := fakeNodeHandler.Get("node0", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
|
@ -2043,7 +2043,7 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
|
|||
if err := nodeController.monitorNodeStatus(); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
nodeController.doTaintingPass()
|
||||
nodeController.doNoExecuteTaintingPass()
|
||||
|
||||
node0, err = fakeNodeHandler.Get("node0", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue