From b2933c0adac0a2935e193c78eccdf9308cf91b0b Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Tue, 8 Apr 2025 14:46:06 -0700 Subject: [PATCH] estimate some system daemonset overhead for max pods --- test/e2e/apimachinery/garbage_collector.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/e2e/apimachinery/garbage_collector.go b/test/e2e/apimachinery/garbage_collector.go index d791d8d1fa1..b096da4f78e 100644 --- a/test/e2e/apimachinery/garbage_collector.go +++ b/test/e2e/apimachinery/garbage_collector.go @@ -59,18 +59,23 @@ func estimateMaximumPods(ctx context.Context, c clientset.Interface, min, max in framework.ExpectNoError(err) availablePods := int32(0) + // estimate some reasonable overhead per-node for pods that are non-test + const daemonSetReservedPods = 10 for _, node := range nodes.Items { if q, ok := node.Status.Allocatable["pods"]; ok { if num, ok := q.AsInt64(); ok { - availablePods += int32(num) + if num > daemonSetReservedPods { + availablePods += int32(num - daemonSetReservedPods) + } continue } } - // best guess per node, since default maxPerCore is 10 and most nodes have at least + // Only when we fail to obtain the number, we fall back to a best guess + // per node. Since default maxPerCore is 10 and most nodes have at least // one core. availablePods += 10 } - //avoid creating exactly max pods + // avoid creating exactly max pods availablePods = int32(float32(availablePods) * 0.5) // bound the top and bottom if availablePods > max {