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
fbb29749
Commit
fbb29749
authored
Sep 07, 2017
by
David Ashpole
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inode eviction only requires filling 200k inodes
parent
42481988
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
18 deletions
+38
-18
inode_eviction_test.go
test/e2e_node/inode_eviction_test.go
+38
-18
No files found.
test/e2e_node/inode_eviction_test.go
View file @
fbb29749
...
@@ -91,12 +91,19 @@ var _ = framework.KubeDescribe("InodeEviction [Slow] [Serial] [Disruptive] [Flak
...
@@ -91,12 +91,19 @@ var _ = framework.KubeDescribe("InodeEviction [Slow] [Serial] [Disruptive] [Flak
pod
:
getInnocentPod
(),
pod
:
getInnocentPod
(),
},
},
}
}
evictionTestTimeout
:=
30
*
time
.
Minute
evictionTestTimeout
:=
15
*
time
.
Minute
testCondition
:=
"Disk Pressure due to Inodes"
testCondition
:=
"Disk Pressure due to Inodes"
inodesConsumed
:=
uint64
(
200000
)
Context
(
fmt
.
Sprintf
(
"when we run containers that should cause %s"
,
testCondition
),
func
()
{
Context
(
fmt
.
Sprintf
(
"when we run containers that should cause %s"
,
testCondition
),
func
()
{
tempSetCurrentKubeletConfig
(
f
,
func
(
initialConfig
*
kubeletconfig
.
KubeletConfiguration
)
{
tempSetCurrentKubeletConfig
(
f
,
func
(
initialConfig
*
kubeletconfig
.
KubeletConfiguration
)
{
initialConfig
.
EvictionHard
=
"nodefs.inodesFree<70%"
// Set the eviction threshold to inodesFree - inodesConsumed, so that using inodesConsumed causes an eviction.
inodesFree
:=
getInodesFree
()
if
inodesFree
<=
inodesConsumed
{
framework
.
Skipf
(
"Too few inodes free on the host for the InodeEviction test to run"
)
}
initialConfig
.
EvictionHard
=
fmt
.
Sprintf
(
"nodefs.inodesFree<%d"
,
getInodesFree
()
-
inodesConsumed
)
initialConfig
.
EvictionMinimumReclaim
=
""
})
})
// Place the remainder of the test within a context so that the kubelet config is set before and after the test.
// Place the remainder of the test within a context so that the kubelet config is set before and after the test.
Context
(
"With kubeconfig updated"
,
func
()
{
Context
(
"With kubeconfig updated"
,
func
()
{
...
@@ -172,7 +179,8 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
...
@@ -172,7 +179,8 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
Expect
(
priorityPod
)
.
NotTo
(
BeNil
())
Expect
(
priorityPod
)
.
NotTo
(
BeNil
())
// Check eviction ordering.
// Check eviction ordering.
// Note: it is alright for a priority 1 and priority 2 pod (for example) to fail in the same round
// Note: it is alright for a priority 1 and priority 2 pod (for example) to fail in the same round,
// but never alright for a priority 1 pod to fail while the priority 2 pod is still running
for
_
,
lowPriorityPodSpec
:=
range
podTestSpecs
{
for
_
,
lowPriorityPodSpec
:=
range
podTestSpecs
{
var
lowPriorityPod
v1
.
Pod
var
lowPriorityPod
v1
.
Pod
for
_
,
p
:=
range
updatedPods
{
for
_
,
p
:=
range
updatedPods
{
...
@@ -249,6 +257,14 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
...
@@ -249,6 +257,14 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
}
}
return
nil
return
nil
},
postTestConditionMonitoringPeriod
,
evictionPollInterval
)
.
Should
(
BeNil
())
},
postTestConditionMonitoringPeriod
,
evictionPollInterval
)
.
Should
(
BeNil
())
})
AfterEach
(
func
()
{
By
(
"deleting pods"
)
for
_
,
spec
:=
range
podTestSpecs
{
By
(
fmt
.
Sprintf
(
"deleting pod: %s"
,
spec
.
pod
.
Name
))
f
.
PodClient
()
.
DeleteSync
(
spec
.
pod
.
Name
,
&
metav1
.
DeleteOptions
{},
10
*
time
.
Minute
)
}
By
(
"making sure we can start a new pod after the test"
)
By
(
"making sure we can start a new pod after the test"
)
podName
:=
"test-admit-pod"
podName
:=
"test-admit-pod"
...
@@ -266,22 +282,10 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
...
@@ -266,22 +282,10 @@ func runEvictionTest(f *framework.Framework, testCondition string, podTestSpecs
},
},
},
},
})
})
})
AfterEach
(
func
()
{
By
(
"deleting pods"
)
for
_
,
spec
:=
range
podTestSpecs
{
By
(
fmt
.
Sprintf
(
"deleting pod: %s"
,
spec
.
pod
.
Name
))
f
.
PodClient
()
.
DeleteSync
(
spec
.
pod
.
Name
,
&
metav1
.
DeleteOptions
{},
framework
.
DefaultPodDeletionTimeout
)
}
if
CurrentGinkgoTestDescription
()
.
Failed
{
if
CurrentGinkgoTestDescription
()
.
Failed
&&
framework
.
TestContext
.
DumpLogsOnFailure
{
if
framework
.
TestContext
.
DumpLogsOnFailure
{
logPodEvents
(
f
)
logPodEvents
(
f
)
logNodeEvents
(
f
)
logNodeEvents
(
f
)
}
By
(
"sleeping to allow for cleanup of test"
)
time
.
Sleep
(
postTestConditionMonitoringPeriod
)
}
}
})
})
}
}
...
@@ -321,6 +325,22 @@ func hasInodePressure(f *framework.Framework, testCondition string) (bool, error
...
@@ -321,6 +325,22 @@ func hasInodePressure(f *framework.Framework, testCondition string) (bool, error
return
hasPressure
,
nil
return
hasPressure
,
nil
}
}
func
getInodesFree
()
uint64
{
var
inodesFree
uint64
Eventually
(
func
()
error
{
summary
,
err
:=
getNodeSummary
()
if
err
!=
nil
{
return
err
}
if
summary
==
nil
||
summary
.
Node
.
Fs
==
nil
||
summary
.
Node
.
Fs
.
InodesFree
==
nil
{
return
fmt
.
Errorf
(
"some part of data is nil"
)
}
inodesFree
=
*
summary
.
Node
.
Fs
.
InodesFree
return
nil
},
time
.
Minute
,
evictionPollInterval
)
.
Should
(
BeNil
())
return
inodesFree
}
// returns a pod that does not use any resources
// returns a pod that does not use any resources
func
getInnocentPod
()
*
v1
.
Pod
{
func
getInnocentPod
()
*
v1
.
Pod
{
return
&
v1
.
Pod
{
return
&
v1
.
Pod
{
...
...
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