Skip to content

Commit

Permalink
BACKPORT: plugin: Ignore completed pods in Filter (#423)
Browse files Browse the repository at this point in the history
PR #416 introduced a regression around our handling of completed pods,
namely that during Filter calls if we process *all* pods, then we'll
still count Failed/Succeeded pods into the node's usage, rather than
ignoring them like we do elsewhere.
  • Loading branch information
sharnoff committed Jul 18, 2023
1 parent 0b74a86 commit 95b83f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,15 @@ func (e *AutoscaleEnforcer) Filter(
} else {
name := util.GetNamespacedName(podInfo.Pod)

if util.PodCompleted(podInfo.Pod) {
logger.Warn(
"Skipping completed Pod in Filter node's pods",
zap.Object("pod", name),
zap.String("phase", string(podInfo.Pod.Status.Phase)),
)
continue
}

if !e.state.conf.ignoredNamespace(podInfo.Pod.Namespace) {
// FIXME: this gets us duplicated "pod" fields. Not great. But we're using
// logger.With pretty pervasively, and it's hard to avoid this while using that.
Expand Down

0 comments on commit 95b83f3

Please sign in to comment.