Skip to content

Commit b2933c0

Browse files
committed
estimate some system daemonset overhead for max pods
1 parent 92af6ab commit b2933c0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/e2e/apimachinery/garbage_collector.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,23 @@ func estimateMaximumPods(ctx context.Context, c clientset.Interface, min, max in
5959
framework.ExpectNoError(err)
6060

6161
availablePods := int32(0)
62+
// estimate some reasonable overhead per-node for pods that are non-test
63+
const daemonSetReservedPods = 10
6264
for _, node := range nodes.Items {
6365
if q, ok := node.Status.Allocatable["pods"]; ok {
6466
if num, ok := q.AsInt64(); ok {
65-
availablePods += int32(num)
67+
if num > daemonSetReservedPods {
68+
availablePods += int32(num - daemonSetReservedPods)
69+
}
6670
continue
6771
}
6872
}
69-
// best guess per node, since default maxPerCore is 10 and most nodes have at least
73+
// Only when we fail to obtain the number, we fall back to a best guess
74+
// per node. Since default maxPerCore is 10 and most nodes have at least
7075
// one core.
7176
availablePods += 10
7277
}
73-
//avoid creating exactly max pods
78+
// avoid creating exactly max pods
7479
availablePods = int32(float32(availablePods) * 0.5)
7580
// bound the top and bottom
7681
if availablePods > max {

0 commit comments

Comments
 (0)