Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
678947d4
Commit
678947d4
authored
Jul 31, 2017
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed zoneNotReadyOrUnreachableTainer to zoneNoExecuteTainer.
parent
d8205661
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
38 deletions
+38
-38
nodecontroller.go
pkg/controller/node/nodecontroller.go
+38
-38
No files found.
pkg/controller/node/nodecontroller.go
View file @
678947d4
...
...
@@ -152,8 +152,8 @@ type NodeController struct {
// workers that evicts pods from unresponsive nodes.
zonePodEvictor
map
[
string
]
*
RateLimitedTimedQueue
// workers that are responsible for tainting nodes.
zoneNo
tReadyOrUnreachabl
eTainer
map
[
string
]
*
RateLimitedTimedQueue
podEvictionTimeout
time
.
Duration
zoneNo
Execut
eTainer
map
[
string
]
*
RateLimitedTimedQueue
podEvictionTimeout
time
.
Duration
// The maximum duration before a pod evicted from a node can be forcefully terminated.
maximumGracePeriod
time
.
Duration
recorder
record
.
EventRecorder
...
...
@@ -241,33 +241,33 @@ func NewNodeController(
}
nc
:=
&
NodeController
{
cloud
:
cloud
,
knownNodeSet
:
make
(
map
[
string
]
*
v1
.
Node
),
kubeClient
:
kubeClient
,
recorder
:
recorder
,
podEvictionTimeout
:
podEvictionTimeout
,
maximumGracePeriod
:
5
*
time
.
Minute
,
zonePodEvictor
:
make
(
map
[
string
]
*
RateLimitedTimedQueue
),
zoneNo
tReadyOrUnreachableTainer
:
make
(
map
[
string
]
*
RateLimitedTimedQueue
),
nodeStatusMap
:
make
(
map
[
string
]
nodeStatusData
),
nodeMonitorGracePeriod
:
nodeMonitorGracePeriod
,
nodeMonitorPeriod
:
nodeMonitorPeriod
,
nodeStartupGracePeriod
:
nodeStartupGracePeriod
,
lookupIP
:
net
.
LookupIP
,
now
:
metav1
.
Now
,
clusterCIDR
:
clusterCIDR
,
serviceCIDR
:
serviceCIDR
,
allocateNodeCIDRs
:
allocateNodeCIDRs
,
allocatorType
:
allocatorType
,
forcefullyDeletePod
:
func
(
p
*
v1
.
Pod
)
error
{
return
forcefullyDeletePod
(
kubeClient
,
p
)
},
nodeExistsInCloudProvider
:
func
(
nodeName
types
.
NodeName
)
(
bool
,
error
)
{
return
nodeExistsInCloudProvider
(
cloud
,
nodeName
)
},
evictionLimiterQPS
:
evictionLimiterQPS
,
secondaryEvictionLimiterQPS
:
secondaryEvictionLimiterQPS
,
largeClusterThreshold
:
largeClusterThreshold
,
unhealthyZoneThreshold
:
unhealthyZoneThreshold
,
zoneStates
:
make
(
map
[
string
]
zoneState
),
runTaintManager
:
runTaintManager
,
useTaintBasedEvictions
:
useTaintBasedEvictions
&&
runTaintManager
,
cloud
:
cloud
,
knownNodeSet
:
make
(
map
[
string
]
*
v1
.
Node
),
kubeClient
:
kubeClient
,
recorder
:
recorder
,
podEvictionTimeout
:
podEvictionTimeout
,
maximumGracePeriod
:
5
*
time
.
Minute
,
zonePodEvictor
:
make
(
map
[
string
]
*
RateLimitedTimedQueue
),
zoneNo
ExecuteTainer
:
make
(
map
[
string
]
*
RateLimitedTimedQueue
),
nodeStatusMap
:
make
(
map
[
string
]
nodeStatusData
),
nodeMonitorGracePeriod
:
nodeMonitorGracePeriod
,
nodeMonitorPeriod
:
nodeMonitorPeriod
,
nodeStartupGracePeriod
:
nodeStartupGracePeriod
,
lookupIP
:
net
.
LookupIP
,
now
:
metav1
.
Now
,
clusterCIDR
:
clusterCIDR
,
serviceCIDR
:
serviceCIDR
,
allocateNodeCIDRs
:
allocateNodeCIDRs
,
allocatorType
:
allocatorType
,
forcefullyDeletePod
:
func
(
p
*
v1
.
Pod
)
error
{
return
forcefullyDeletePod
(
kubeClient
,
p
)
},
nodeExistsInCloudProvider
:
func
(
nodeName
types
.
NodeName
)
(
bool
,
error
)
{
return
nodeExistsInCloudProvider
(
cloud
,
nodeName
)
},
evictionLimiterQPS
:
evictionLimiterQPS
,
secondaryEvictionLimiterQPS
:
secondaryEvictionLimiterQPS
,
largeClusterThreshold
:
largeClusterThreshold
,
unhealthyZoneThreshold
:
unhealthyZoneThreshold
,
zoneStates
:
make
(
map
[
string
]
zoneState
),
runTaintManager
:
runTaintManager
,
useTaintBasedEvictions
:
useTaintBasedEvictions
&&
runTaintManager
,
}
if
useTaintBasedEvictions
{
glog
.
Infof
(
"NodeController is using taint based evictions."
)
...
...
@@ -437,9 +437,9 @@ func (nc *NodeController) doEvictionPass() {
func
(
nc
*
NodeController
)
doTaintingPass
()
{
nc
.
evictorLock
.
Lock
()
defer
nc
.
evictorLock
.
Unlock
()
for
k
:=
range
nc
.
zoneNo
tReadyOrUnreachabl
eTainer
{
for
k
:=
range
nc
.
zoneNo
Execut
eTainer
{
// Function should return 'false' and a time after which it should be retried, or 'true' if it shouldn't (it succeeded).
nc
.
zoneNo
tReadyOrUnreachabl
eTainer
[
k
]
.
Try
(
func
(
value
TimedValue
)
(
bool
,
time
.
Duration
)
{
nc
.
zoneNo
Execut
eTainer
[
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
)
...
...
@@ -519,7 +519,7 @@ func (nc *NodeController) addPodEvictorForNewZone(node *v1.Node) {
NewRateLimitedTimedQueue
(
flowcontrol
.
NewTokenBucketRateLimiter
(
nc
.
evictionLimiterQPS
,
evictionRateLimiterBurst
))
}
else
{
nc
.
zoneNo
tReadyOrUnreachabl
eTainer
[
zone
]
=
nc
.
zoneNo
Execut
eTainer
[
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
.
zoneNo
tReadyOrUnreachabl
eTainer
[
k
]
.
SwapLimiter
(
0
)
nc
.
zoneNo
Execut
eTainer
[
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
.
zoneNo
tReadyOrUnreachabl
eTainer
[
zone
]
.
SwapLimiter
(
nc
.
evictionLimiterQPS
)
nc
.
zoneNo
Execut
eTainer
[
zone
]
.
SwapLimiter
(
nc
.
evictionLimiterQPS
)
}
else
{
nc
.
zonePodEvictor
[
zone
]
.
SwapLimiter
(
nc
.
evictionLimiterQPS
)
}
case
statePartialDisruption
:
if
nc
.
useTaintBasedEvictions
{
nc
.
zoneNo
tReadyOrUnreachabl
eTainer
[
zone
]
.
SwapLimiter
(
nc
.
zoneNo
Execut
eTainer
[
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
.
zoneNo
tReadyOrUnreachabl
eTainer
[
zone
]
.
SwapLimiter
(
nc
.
zoneNo
Execut
eTainer
[
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
.
zoneNo
tReadyOrUnreachabl
eTainer
[
utilnode
.
GetZoneKey
(
node
)]
.
Add
(
node
.
Name
,
string
(
node
.
UID
))
return
nc
.
zoneNo
Execut
eTainer
[
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
.
zoneNo
tReadyOrUnreachabl
eTainer
[
utilnode
.
GetZoneKey
(
node
)]
.
Remove
(
node
.
Name
),
nil
return
nc
.
zoneNo
Execut
eTainer
[
utilnode
.
GetZoneKey
(
node
)]
.
Remove
(
node
.
Name
),
nil
}
// Default value for cluster eviction rate - we take nodeNum for consistency with ReducedQPSFunc.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment