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
5d19fda5
Unverified
Commit
5d19fda5
authored
Jan 16, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72844 from dashpole/fork_bomb_test
Fix PidPressure, and add fork-bomb e2e-node test
parents
0713f29c
8b440c64
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
22 deletions
+98
-22
types.go
pkg/kubelet/eviction/api/types.go
+1
-0
eviction_manager.go
pkg/kubelet/eviction/eviction_manager.go
+1
-1
helpers.go
pkg/kubelet/eviction/helpers.go
+11
-0
helpers_test.go
pkg/kubelet/eviction/helpers_test.go
+6
-6
BUILD
test/e2e_node/BUILD
+1
-0
eviction_test.go
test/e2e_node/eviction_test.go
+78
-15
No files found.
pkg/kubelet/eviction/api/types.go
View file @
5d19fda5
...
...
@@ -63,6 +63,7 @@ var OpForSignal = map[Signal]ThresholdOperator{
SignalNodeFsInodesFree
:
OpLessThan
,
SignalImageFsAvailable
:
OpLessThan
,
SignalImageFsInodesFree
:
OpLessThan
,
SignalPIDAvailable
:
OpLessThan
,
}
// ThresholdValue is a value holder that abstracts literal versus percentage based quantity
...
...
pkg/kubelet/eviction/eviction_manager.go
View file @
5d19fda5
...
...
@@ -157,7 +157,7 @@ func (m *managerImpl) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd
return
lifecycle
.
PodAdmitResult
{
Admit
:
false
,
Reason
:
Reason
,
Message
:
fmt
.
Sprintf
(
node
Low
MessageFmt
,
m
.
nodeConditions
),
Message
:
fmt
.
Sprintf
(
node
Condition
MessageFmt
,
m
.
nodeConditions
),
}
}
...
...
pkg/kubelet/eviction/helpers.go
View file @
5d19fda5
...
...
@@ -40,6 +40,8 @@ const (
Reason
=
"Evicted"
// nodeLowMessageFmt is the message for evictions due to resource pressure.
nodeLowMessageFmt
=
"The node was low on resource: %v. "
// nodeConditionMessageFmt is the message for evictions due to resource pressure.
nodeConditionMessageFmt
=
"The node had condition: %v. "
// containerMessageFmt provides additional information for containers exceeding requests
containerMessageFmt
=
"Container %s was using %s, which exceeds its request of %s. "
// containerEphemeralStorageMessageFmt provides additional information for containers which have exceeded their ES limit
...
...
@@ -50,6 +52,8 @@ const (
emptyDirMessageFmt
=
"Usage of EmptyDir volume %q exceeds the limit %q. "
// inodes, number. internal to this module, used to account for local disk inode consumption.
resourceInodes
v1
.
ResourceName
=
"inodes"
// resourcePids, number. internal to this module, used to account for local pid consumption.
resourcePids
v1
.
ResourceName
=
"pids"
// OffendingContainersKey is the key in eviction event annotations for the list of container names which exceeded their requests
OffendingContainersKey
=
"offending_containers"
// OffendingContainersUsageKey is the key in eviction event annotations for the list of usage of containers which exceeded their requests
...
...
@@ -84,6 +88,7 @@ func init() {
signalToResource
[
evictionapi
.
SignalImageFsInodesFree
]
=
resourceInodes
signalToResource
[
evictionapi
.
SignalNodeFsAvailable
]
=
v1
.
ResourceEphemeralStorage
signalToResource
[
evictionapi
.
SignalNodeFsInodesFree
]
=
resourceInodes
signalToResource
[
evictionapi
.
SignalPIDAvailable
]
=
resourcePids
}
// validSignal returns true if the signal is supported.
...
...
@@ -674,6 +679,11 @@ func rankMemoryPressure(pods []*v1.Pod, stats statsFunc) {
orderedBy
(
exceedMemoryRequests
(
stats
),
priority
,
memory
(
stats
))
.
Sort
(
pods
)
}
// rankPIDPressure orders the input pods by priority in response to PID pressure.
func
rankPIDPressure
(
pods
[]
*
v1
.
Pod
,
stats
statsFunc
)
{
orderedBy
(
priority
)
.
Sort
(
pods
)
}
// rankDiskPressureFunc returns a rankFunc that measures the specified fs stats.
func
rankDiskPressureFunc
(
fsStatsToMeasure
[]
fsStatsType
,
diskResource
v1
.
ResourceName
)
rankFunc
{
return
func
(
pods
[]
*
v1
.
Pod
,
stats
statsFunc
)
{
...
...
@@ -987,6 +997,7 @@ func buildSignalToRankFunc(withImageFs bool) map[evictionapi.Signal]rankFunc {
signalToRankFunc
:=
map
[
evictionapi
.
Signal
]
rankFunc
{
evictionapi
.
SignalMemoryAvailable
:
rankMemoryPressure
,
evictionapi
.
SignalAllocatableMemoryAvailable
:
rankMemoryPressure
,
evictionapi
.
SignalPIDAvailable
:
rankPIDPressure
,
}
// usage of an imagefs is optional
if
withImageFs
{
...
...
pkg/kubelet/eviction/helpers_test.go
View file @
5d19fda5
...
...
@@ -943,13 +943,13 @@ func TestSortByEvictionPriority(t *testing.T) {
expected
:
[]
evictionapi
.
Threshold
{},
},
{
name
:
"memory first
, PID last
"
,
name
:
"memory first"
,
thresholds
:
[]
evictionapi
.
Threshold
{
{
Signal
:
evictionapi
.
Signal
PID
Available
,
Signal
:
evictionapi
.
Signal
NodeFs
Available
,
},
{
Signal
:
evictionapi
.
Signal
NodeFs
Available
,
Signal
:
evictionapi
.
Signal
PID
Available
,
},
{
Signal
:
evictionapi
.
SignalMemoryAvailable
,
...
...
@@ -968,13 +968,13 @@ func TestSortByEvictionPriority(t *testing.T) {
},
},
{
name
:
"allocatable memory first
, PID last
"
,
name
:
"allocatable memory first"
,
thresholds
:
[]
evictionapi
.
Threshold
{
{
Signal
:
evictionapi
.
Signal
PID
Available
,
Signal
:
evictionapi
.
Signal
NodeFs
Available
,
},
{
Signal
:
evictionapi
.
Signal
NodeFs
Available
,
Signal
:
evictionapi
.
Signal
PID
Available
,
},
{
Signal
:
evictionapi
.
SignalAllocatableMemoryAvailable
,
...
...
test/e2e_node/BUILD
View file @
5d19fda5
...
...
@@ -123,6 +123,7 @@ go_test(
"//pkg/kubelet/cm/cpuset:go_default_library",
"//pkg/kubelet/container:go_default_library",
"//pkg/kubelet/eviction:go_default_library",
"//pkg/kubelet/eviction/api:go_default_library",
"//pkg/kubelet/images:go_default_library",
"//pkg/kubelet/kubeletconfig:go_default_library",
"//pkg/kubelet/kubeletconfig/status:go_default_library",
...
...
test/e2e_node/eviction_test.go
View file @
5d19fda5
This diff is collapsed.
Click to expand it.
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