mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
still consider quantity reclaimed even when errors are returned
This commit is contained in:
parent
433aec11c8
commit
958e290c8d
@ -380,23 +380,22 @@ func (m *managerImpl) reclaimNodeLevelResources(resourceToReclaim v1.ResourceNam
|
|||||||
for _, nodeReclaimFunc := range nodeReclaimFuncs {
|
for _, nodeReclaimFunc := range nodeReclaimFuncs {
|
||||||
// attempt to reclaim the pressured resource.
|
// attempt to reclaim the pressured resource.
|
||||||
reclaimed, err := nodeReclaimFunc()
|
reclaimed, err := nodeReclaimFunc()
|
||||||
if err == nil {
|
if err != nil {
|
||||||
// update our local observations based on the amount reported to have been reclaimed.
|
glog.Warningf("eviction manager: unexpected error when attempting to reduce %v pressure: %v", resourceToReclaim, err)
|
||||||
// note: this is optimistic, other things could have been still consuming the pressured resource in the interim.
|
}
|
||||||
signal := resourceToSignal[resourceToReclaim]
|
// update our local observations based on the amount reported to have been reclaimed.
|
||||||
value, ok := observations[signal]
|
// note: this is optimistic, other things could have been still consuming the pressured resource in the interim.
|
||||||
if !ok {
|
signal := resourceToSignal[resourceToReclaim]
|
||||||
glog.Errorf("eviction manager: unable to find value associated with signal %v", signal)
|
value, ok := observations[signal]
|
||||||
continue
|
if !ok {
|
||||||
}
|
glog.Errorf("eviction manager: unable to find value associated with signal %v", signal)
|
||||||
value.available.Add(*reclaimed)
|
continue
|
||||||
|
}
|
||||||
|
value.available.Add(*reclaimed)
|
||||||
|
|
||||||
// evaluate all current thresholds to see if with adjusted observations, we think we have met min reclaim goals
|
// 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 {
|
if len(thresholdsMet(m.thresholdsMet, observations, true)) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
} else {
|
|
||||||
glog.Errorf("eviction manager: unexpected error when attempting to reduce %v pressure: %v", resourceToReclaim, err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -76,7 +76,8 @@ type NodeProvider interface {
|
|||||||
|
|
||||||
// ImageGC is responsible for performing garbage collection of unused images.
|
// ImageGC is responsible for performing garbage collection of unused images.
|
||||||
type ImageGC interface {
|
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)
|
DeleteUnusedImages() (int64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +119,8 @@ type thresholdsObservedAt map[evictionapi.Threshold]time.Time
|
|||||||
type nodeConditionsObservedAt map[v1.NodeConditionType]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.
|
// 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)
|
type nodeReclaimFunc func() (*resource.Quantity, error)
|
||||||
|
|
||||||
// nodeReclaimFuncs is an ordered list of nodeReclaimFunc
|
// nodeReclaimFuncs is an ordered list of nodeReclaimFunc
|
||||||
|
Loading…
Reference in New Issue
Block a user