mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Bug fix: Should allow alias range size equals to max number of pods * 2
This commit is contained in:
parent
c005b9d0ab
commit
a806e37851
@ -99,13 +99,13 @@ function get-cluster-ip-range {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Calculate ip alias range based on max number of pods.
|
# Calculate ip alias range based on max number of pods.
|
||||||
# Let pow be the smallest integer which is bigger than log2($1 * 2).
|
# Let pow be the smallest integer which is bigger or equal to log2($1 * 2).
|
||||||
# (32 - pow) will be returned.
|
# (32 - pow) will be returned.
|
||||||
#
|
#
|
||||||
# $1: The number of max pods limitation.
|
# $1: The number of max pods limitation.
|
||||||
function get-alias-range-size() {
|
function get-alias-range-size() {
|
||||||
for pow in {0..31}; do
|
for pow in {0..31}; do
|
||||||
if (( 1 << $pow > $1 * 2 )); then
|
if (( 1 << $pow >= $1 * 2 )); then
|
||||||
echo $((32 - pow))
|
echo $((32 - pow))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user