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
958e290c
Commit
958e290c
authored
Apr 26, 2017
by
David Ashpole
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
still consider quantity reclaimed even when errors are returned
parent
433aec11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
18 deletions
+20
-18
eviction_manager.go
pkg/kubelet/eviction/eviction_manager.go
+16
-17
types.go
pkg/kubelet/eviction/types.go
+4
-1
No files found.
pkg/kubelet/eviction/eviction_manager.go
View file @
958e290c
...
...
@@ -380,23 +380,22 @@ func (m *managerImpl) reclaimNodeLevelResources(resourceToReclaim v1.ResourceNam
for
_
,
nodeReclaimFunc
:=
range
nodeReclaimFuncs
{
// attempt to reclaim the pressured resource.
reclaimed
,
err
:=
nodeReclaimFunc
()
if
err
==
nil
{
// update our local observations based on the amount reported to have been reclaimed.
// note: this is optimistic, other things could have been still consuming the pressured resource in the interim.
signal
:=
resourceToSignal
[
resourceToReclaim
]
value
,
ok
:=
observations
[
signal
]
if
!
ok
{
glog
.
Errorf
(
"eviction manager: unable to find value associated with signal %v"
,
signal
)
continue
}
value
.
available
.
Add
(
*
reclaimed
)
// evaluate all current thresholds to see if with adjusted observations, we think we have met min reclaim goals
if
len
(
thresholdsMet
(
m
.
thresholdsMet
,
observations
,
true
))
==
0
{
return
true
}
}
else
{
glog
.
Errorf
(
"eviction manager: unexpected error when attempting to reduce %v pressure: %v"
,
resourceToReclaim
,
err
)
if
err
!=
nil
{
glog
.
Warningf
(
"eviction manager: unexpected error when attempting to reduce %v pressure: %v"
,
resourceToReclaim
,
err
)
}
// update our local observations based on the amount reported to have been reclaimed.
// note: this is optimistic, other things could have been still consuming the pressured resource in the interim.
signal
:=
resourceToSignal
[
resourceToReclaim
]
value
,
ok
:=
observations
[
signal
]
if
!
ok
{
glog
.
Errorf
(
"eviction manager: unable to find value associated with signal %v"
,
signal
)
continue
}
value
.
available
.
Add
(
*
reclaimed
)
// evaluate all current thresholds to see if with adjusted observations, we think we have met min reclaim goals
if
len
(
thresholdsMet
(
m
.
thresholdsMet
,
observations
,
true
))
==
0
{
return
true
}
}
return
false
...
...
pkg/kubelet/eviction/types.go
View file @
958e290c
...
...
@@ -76,7 +76,8 @@ type NodeProvider interface {
// ImageGC is responsible for performing garbage collection of unused images.
type
ImageGC
interface
{
// DeleteUnusedImages deletes unused images and returns the number of bytes freed, or an error.
// DeleteUnusedImages deletes unused images and returns the number of bytes freed, and an error.
// This returns the bytes freed even if an error is returned.
DeleteUnusedImages
()
(
int64
,
error
)
}
...
...
@@ -118,6 +119,8 @@ type thresholdsObservedAt map[evictionapi.Threshold]time.Time
type
nodeConditionsObservedAt
map
[
v1
.
NodeConditionType
]
time
.
Time
// nodeReclaimFunc is a function that knows how to reclaim a resource from the node without impacting pods.
// Returns the quantity of resources reclaimed and an error, if applicable.
// nodeReclaimFunc return the resources reclaimed even if an error occurs.
type
nodeReclaimFunc
func
()
(
*
resource
.
Quantity
,
error
)
// nodeReclaimFuncs is an ordered list of nodeReclaimFunc
...
...
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