Skip to content

Commit

Permalink
fix(eviction): fix rootfs eviction protection
Browse files Browse the repository at this point in the history
  • Loading branch information
nightmeng committed Jan 31, 2024
1 parent 7951668 commit 92e1963
Show file tree
Hide file tree
Showing 2 changed files with 420 additions and 16 deletions.
16 changes: 6 additions & 10 deletions pkg/agent/evictionmanager/plugin/rootfs/rootfs_pressure.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,10 @@ func (r *PodRootfsPressureEvictionPlugin) podMinimumUsageProtectionMet(usage int
if minUsedThreshold == nil {
return false
}
if minUsedThreshold.Quantity != nil && usage < minUsedThreshold.Quantity.Value() {
return true
} else if percentage < float64(minUsedThreshold.Percentage) {
return true
if minUsedThreshold.Quantity != nil {
return usage < minUsedThreshold.Quantity.Value()
} else {
return false
return percentage < float64(minUsedThreshold.Percentage)
}
}

Expand All @@ -305,12 +303,10 @@ func (r *PodRootfsPressureEvictionPlugin) reclaimedPodPriorityEvictionMet(pod *v
if !isReclaimedPod {
return false
}
if reclaimedPodPriorityUsedThreshold.Quantity != nil && used > reclaimedPodPriorityUsedThreshold.Quantity.Value() {
return true
} else if percentage > float64(reclaimedPodPriorityUsedThreshold.Percentage) {
return true
if reclaimedPodPriorityUsedThreshold.Quantity != nil {
return used > reclaimedPodPriorityUsedThreshold.Quantity.Value()
} else {
return false
return percentage > float64(reclaimedPodPriorityUsedThreshold.Percentage)
}
}

Expand Down
Loading

0 comments on commit 92e1963

Please sign in to comment.