mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
estimate some system daemonset overhead for max pods
This commit is contained in:
parent
92af6ab692
commit
b2933c0ada
@ -59,18 +59,23 @@ func estimateMaximumPods(ctx context.Context, c clientset.Interface, min, max in
|
|||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
availablePods := int32(0)
|
availablePods := int32(0)
|
||||||
|
// estimate some reasonable overhead per-node for pods that are non-test
|
||||||
|
const daemonSetReservedPods = 10
|
||||||
for _, node := range nodes.Items {
|
for _, node := range nodes.Items {
|
||||||
if q, ok := node.Status.Allocatable["pods"]; ok {
|
if q, ok := node.Status.Allocatable["pods"]; ok {
|
||||||
if num, ok := q.AsInt64(); ok {
|
if num, ok := q.AsInt64(); ok {
|
||||||
availablePods += int32(num)
|
if num > daemonSetReservedPods {
|
||||||
|
availablePods += int32(num - daemonSetReservedPods)
|
||||||
|
}
|
||||||
continue
|
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.
|
// one core.
|
||||||
availablePods += 10
|
availablePods += 10
|
||||||
}
|
}
|
||||||
//avoid creating exactly max pods
|
// avoid creating exactly max pods
|
||||||
availablePods = int32(float32(availablePods) * 0.5)
|
availablePods = int32(float32(availablePods) * 0.5)
|
||||||
// bound the top and bottom
|
// bound the top and bottom
|
||||||
if availablePods > max {
|
if availablePods > max {
|
||||||
|
Loading…
Reference in New Issue
Block a user