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
3ad9a1e4
Commit
3ad9a1e4
authored
Sep 01, 2016
by
Michael Taufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move wait for pressure to subside to AfterEach so we still wait if the test for…
Move wait for pressure to subside to AfterEach so we still wait if the test for eviction order fails
parent
f673bc88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
59 deletions
+63
-59
memory_eviction_test.go
test/e2e_node/memory_eviction_test.go
+63
-59
No files found.
test/e2e_node/memory_eviction_test.go
View file @
3ad9a1e4
...
@@ -37,66 +37,9 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
...
@@ -37,66 +37,9 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
f
:=
framework
.
NewDefaultFramework
(
"eviction-test"
)
f
:=
framework
.
NewDefaultFramework
(
"eviction-test"
)
Context
(
"when there is memory pressure"
,
func
()
{
Context
(
"when there is memory pressure"
,
func
()
{
It
(
"should evict pods in the correct order (besteffort first, then burstable, then guaranteed)"
,
func
()
{
AfterEach
(
func
()
{
By
(
"creating a guaranteed pod, a burstable pod, and a besteffort pod."
)
// A pod is guaranteed only when requests and limits are specified for all the containers and they are equal.
guaranteed
:=
createMemhogPod
(
f
,
"guaranteed-"
,
"guaranteed"
,
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
},
Limits
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
}})
// A pod is burstable if limits and requests do not match across all containers.
burstable
:=
createMemhogPod
(
f
,
"burstable-"
,
"burstable"
,
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
}})
// A pod is besteffort if none of its containers have specified any requests or limits.
besteffort
:=
createMemhogPod
(
f
,
"besteffort-"
,
"besteffort"
,
api
.
ResourceRequirements
{})
// We poll until timeout or all pods are killed.
// Inside the func, we check that all pods are in a valid phase with
// respect to the eviction order of best effort, then burstable, then guaranteed.
By
(
"polling the Status.Phase of each pod and checking for violations of the eviction order."
)
Eventually
(
func
()
error
{
gteed
,
gtErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
guaranteed
.
Name
)
framework
.
ExpectNoError
(
gtErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
guaranteed
.
Name
))
gteedPh
:=
gteed
.
Status
.
Phase
burst
,
buErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
burstable
.
Name
)
framework
.
ExpectNoError
(
buErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
burstable
.
Name
))
burstPh
:=
burst
.
Status
.
Phase
best
,
beErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
besteffort
.
Name
)
framework
.
ExpectNoError
(
beErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
besteffort
.
Name
))
bestPh
:=
best
.
Status
.
Phase
glog
.
Infof
(
"pod phase: guaranteed: %v, burstable: %v, besteffort: %v"
,
gteedPh
,
burstPh
,
bestPh
)
if
bestPh
==
api
.
PodRunning
{
Expect
(
burstPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"burstable pod failed before best effort pod"
)
Expect
(
gteedPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"guaranteed pod failed before best effort pod"
)
}
else
if
burstPh
==
api
.
PodRunning
{
Expect
(
gteedPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"guaranteed pod failed before burstable pod"
)
}
// When both besteffort and burstable have been evicted, the test has completed.
if
bestPh
==
api
.
PodFailed
&&
burstPh
==
api
.
PodFailed
{
return
nil
}
return
fmt
.
Errorf
(
"besteffort and burstable have not yet both been evicted."
)
},
60
*
time
.
Minute
,
5
*
time
.
Second
)
.
Should
(
BeNil
())
// Wait for the memory pressure condition to disappear from the node status before continuing.
// Wait for the memory pressure condition to disappear from the node status before continuing.
By
(
"waiting for the memory pressure condition on the node to disappear before ending the test."
)
Eventually
(
func
()
error
{
Eventually
(
func
()
error
{
nodeList
,
err
:=
f
.
Client
.
Nodes
()
.
List
(
api
.
ListOptions
{})
nodeList
,
err
:=
f
.
Client
.
Nodes
()
.
List
(
api
.
ListOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -167,6 +110,67 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
...
@@ -167,6 +110,67 @@ var _ = framework.KubeDescribe("MemoryEviction [Slow] [Serial] [Disruptive]", fu
},
},
})
})
})
})
It
(
"should evict pods in the correct order (besteffort first, then burstable, then guaranteed)"
,
func
()
{
By
(
"creating a guaranteed pod, a burstable pod, and a besteffort pod."
)
// A pod is guaranteed only when requests and limits are specified for all the containers and they are equal.
guaranteed
:=
createMemhogPod
(
f
,
"guaranteed-"
,
"guaranteed"
,
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
},
Limits
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
}})
// A pod is burstable if limits and requests do not match across all containers.
burstable
:=
createMemhogPod
(
f
,
"burstable-"
,
"burstable"
,
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
"cpu"
:
resource
.
MustParse
(
"100m"
),
"memory"
:
resource
.
MustParse
(
"100Mi"
),
}})
// A pod is besteffort if none of its containers have specified any requests or limits.
besteffort
:=
createMemhogPod
(
f
,
"besteffort-"
,
"besteffort"
,
api
.
ResourceRequirements
{})
// We poll until timeout or all pods are killed.
// Inside the func, we check that all pods are in a valid phase with
// respect to the eviction order of best effort, then burstable, then guaranteed.
By
(
"polling the Status.Phase of each pod and checking for violations of the eviction order."
)
Eventually
(
func
()
error
{
gteed
,
gtErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
guaranteed
.
Name
)
framework
.
ExpectNoError
(
gtErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
guaranteed
.
Name
))
gteedPh
:=
gteed
.
Status
.
Phase
burst
,
buErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
burstable
.
Name
)
framework
.
ExpectNoError
(
buErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
burstable
.
Name
))
burstPh
:=
burst
.
Status
.
Phase
best
,
beErr
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
besteffort
.
Name
)
framework
.
ExpectNoError
(
beErr
,
fmt
.
Sprintf
(
"getting pod %s"
,
besteffort
.
Name
))
bestPh
:=
best
.
Status
.
Phase
glog
.
Infof
(
"pod phase: guaranteed: %v, burstable: %v, besteffort: %v"
,
gteedPh
,
burstPh
,
bestPh
)
if
bestPh
==
api
.
PodRunning
{
Expect
(
burstPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"burstable pod failed before best effort pod"
)
Expect
(
gteedPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"guaranteed pod failed before best effort pod"
)
}
else
if
burstPh
==
api
.
PodRunning
{
Expect
(
gteedPh
)
.
NotTo
(
Equal
(
api
.
PodFailed
),
"guaranteed pod failed before burstable pod"
)
}
// When both besteffort and burstable have been evicted, the test has completed.
if
bestPh
==
api
.
PodFailed
&&
burstPh
==
api
.
PodFailed
{
return
nil
}
return
fmt
.
Errorf
(
"besteffort and burstable have not yet both been evicted."
)
},
60
*
time
.
Minute
,
5
*
time
.
Second
)
.
Should
(
BeNil
())
})
})
})
})
})
...
...
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