Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5402427a
Commit
5402427a
authored
May 09, 2018
by
yankaiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport MAX_PODS_PER_NODE env from #63114 to 1.10
parent
42ce74e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
4 deletions
+40
-4
config-common.sh
cluster/gce/config-common.sh
+16
-0
config-default.sh
cluster/gce/config-default.sh
+8
-2
config-test.sh
cluster/gce/config-test.sh
+8
-2
util.sh
cluster/gce/util.sh
+8
-0
No files found.
cluster/gce/config-common.sh
View file @
5402427a
...
@@ -98,6 +98,22 @@ function get-cluster-ip-range {
...
@@ -98,6 +98,22 @@ function get-cluster-ip-range {
echo
"
${
suggested_range
}
"
echo
"
${
suggested_range
}
"
}
}
# Calculate ip alias range based on max number of pods.
# Let pow be the smallest integer which is bigger than log2($1 * 2).
# (32 - pow) will be returned.
#
# $1: The number of max pods limitation.
function
get-alias-range-size
()
{
for
pow
in
{
0..31
}
;
do
if
((
1 <<
$pow
>
$1
*
2
))
;
then
echo
$((
32
-
pow
))
return
0
fi
done
echo
-e
"
${
color_red
}
Error finding an alias range for
$1
IPs."
>
&2
exit
1
}
# NOTE: Avoid giving nodes empty scopes, because kubelet needs a service account
# NOTE: Avoid giving nodes empty scopes, because kubelet needs a service account
# in order to initialize properly.
# in order to initialize properly.
NODE_SCOPES
=
"
${
NODE_SCOPES
:-
monitoring
,logging-write,storage-ro
}
"
NODE_SCOPES
=
"
${
NODE_SCOPES
:-
monitoring
,logging-write,storage-ro
}
"
cluster/gce/config-default.sh
View file @
5402427a
...
@@ -265,8 +265,10 @@ ENABLE_RESCHEDULER="${KUBE_ENABLE_RESCHEDULER:-true}"
...
@@ -265,8 +265,10 @@ ENABLE_RESCHEDULER="${KUBE_ENABLE_RESCHEDULER:-true}"
ENABLE_IP_ALIASES
=
${
KUBE_GCE_ENABLE_IP_ALIASES
:-
false
}
ENABLE_IP_ALIASES
=
${
KUBE_GCE_ENABLE_IP_ALIASES
:-
false
}
NODE_IPAM_MODE
=
${
KUBE_GCE_NODE_IPAM_MODE
:-
RangeAllocator
}
NODE_IPAM_MODE
=
${
KUBE_GCE_NODE_IPAM_MODE
:-
RangeAllocator
}
if
[
${
ENABLE_IP_ALIASES
}
=
true
]
;
then
if
[
${
ENABLE_IP_ALIASES
}
=
true
]
;
then
# Size of ranges allocated to each node. Currently supports only /32 and /24.
# Number of Pods that can run on this node.
IP_ALIAS_SIZE
=
${
KUBE_GCE_IP_ALIAS_SIZE
:-
/24
}
MAX_PODS_PER_NODE
=
${
MAX_PODS_PER_NODE
:-
110
}
# Size of ranges allocated to each node.
IP_ALIAS_SIZE
=
"/
$(
get-alias-range-size
${
MAX_PODS_PER_NODE
})
"
IP_ALIAS_SUBNETWORK
=
${
KUBE_GCE_IP_ALIAS_SUBNETWORK
:-${
INSTANCE_PREFIX
}
-subnet-default
}
IP_ALIAS_SUBNETWORK
=
${
KUBE_GCE_IP_ALIAS_SUBNETWORK
:-${
INSTANCE_PREFIX
}
-subnet-default
}
# If we're using custom network, use the subnet we already create for it as the one for ip-alias.
# If we're using custom network, use the subnet we already create for it as the one for ip-alias.
# Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
# Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
...
@@ -281,6 +283,10 @@ if [ ${ENABLE_IP_ALIASES} = true ]; then
...
@@ -281,6 +283,10 @@ if [ ${ENABLE_IP_ALIASES} = true ]; then
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
ENABLE_IP_ALIASES"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
ENABLE_IP_ALIASES"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
NODE_IPAM_MODE"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
NODE_IPAM_MODE"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
SECONDARY_RANGE_NAME"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
SECONDARY_RANGE_NAME"
elif
[[
-n
"
${
MAX_PODS_PER_NODE
:-}
"
]]
;
then
# Should not have MAX_PODS_PER_NODE set for route-based clusters.
echo
-e
"
${
color_red
}
Cannot set MAX_PODS_PER_NODE for route-based projects for
${
PROJECT
}
."
>
&2
exit
1
fi
fi
# Enable GCE Alpha features.
# Enable GCE Alpha features.
...
...
cluster/gce/config-test.sh
View file @
5402427a
...
@@ -287,8 +287,10 @@ ENABLE_RESCHEDULER="${KUBE_ENABLE_RESCHEDULER:-true}"
...
@@ -287,8 +287,10 @@ ENABLE_RESCHEDULER="${KUBE_ENABLE_RESCHEDULER:-true}"
ENABLE_IP_ALIASES
=
${
KUBE_GCE_ENABLE_IP_ALIASES
:-
false
}
ENABLE_IP_ALIASES
=
${
KUBE_GCE_ENABLE_IP_ALIASES
:-
false
}
NODE_IPAM_MODE
=
${
KUBE_GCE_NODE_IPAM_MODE
:-
RangeAllocator
}
NODE_IPAM_MODE
=
${
KUBE_GCE_NODE_IPAM_MODE
:-
RangeAllocator
}
if
[
${
ENABLE_IP_ALIASES
}
=
true
]
;
then
if
[
${
ENABLE_IP_ALIASES
}
=
true
]
;
then
# Size of ranges allocated to each node. gcloud current supports only /32 and /24.
# Number of Pods that can run on this node.
IP_ALIAS_SIZE
=
${
KUBE_GCE_IP_ALIAS_SIZE
:-
/24
}
MAX_PODS_PER_NODE
=
${
MAX_PODS_PER_NODE
:-
110
}
# Size of ranges allocated to each node.
IP_ALIAS_SIZE
=
"/
$(
get-alias-range-size
${
MAX_PODS_PER_NODE
})
"
IP_ALIAS_SUBNETWORK
=
${
KUBE_GCE_IP_ALIAS_SUBNETWORK
:-${
INSTANCE_PREFIX
}
-subnet-default
}
IP_ALIAS_SUBNETWORK
=
${
KUBE_GCE_IP_ALIAS_SUBNETWORK
:-${
INSTANCE_PREFIX
}
-subnet-default
}
# If we're using custom network, use the subnet we already create for it as the one for ip-alias.
# If we're using custom network, use the subnet we already create for it as the one for ip-alias.
# Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
# Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
...
@@ -303,6 +305,10 @@ if [ ${ENABLE_IP_ALIASES} = true ]; then
...
@@ -303,6 +305,10 @@ if [ ${ENABLE_IP_ALIASES} = true ]; then
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
ENABLE_IP_ALIASES"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
ENABLE_IP_ALIASES"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
NODE_IPAM_MODE"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
NODE_IPAM_MODE"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
SECONDARY_RANGE_NAME"
PROVIDER_VARS
=
"
${
PROVIDER_VARS
:-}
SECONDARY_RANGE_NAME"
elif
[[
-n
"
${
MAX_PODS_PER_NODE
:-}
"
]]
;
then
# Should not have MAX_PODS_PER_NODE set for route-based clusters.
echo
-e
"
${
color_red
}
Cannot set MAX_PODS_PER_NODE for route-based projects for
${
PROJECT
}
."
>
&2
exit
1
fi
fi
# Enable GCE Alpha features.
# Enable GCE Alpha features.
...
...
cluster/gce/util.sh
View file @
5402427a
...
@@ -626,6 +626,9 @@ function construct-kubelet-flags {
...
@@ -626,6 +626,9 @@ function construct-kubelet-flags {
if
[[
-n
"
${
CONTAINER_RUNTIME_ENDPOINT
:-}
"
]]
;
then
if
[[
-n
"
${
CONTAINER_RUNTIME_ENDPOINT
:-}
"
]]
;
then
flags+
=
" --container-runtime-endpoint=
${
CONTAINER_RUNTIME_ENDPOINT
}
"
flags+
=
" --container-runtime-endpoint=
${
CONTAINER_RUNTIME_ENDPOINT
}
"
fi
fi
if
[[
-n
"
${
MAX_PODS_PER_NODE
:-}
"
]]
;
then
flags+
=
" --max-pods=
${
MAX_PODS_PER_NODE
}
"
fi
KUBELET_ARGS
=
"
${
flags
}
"
KUBELET_ARGS
=
"
${
flags
}
"
}
}
...
@@ -998,6 +1001,11 @@ EOF
...
@@ -998,6 +1001,11 @@ EOF
SCHEDULING_ALGORITHM_PROVIDER:
$(
yaml-quote
${
SCHEDULING_ALGORITHM_PROVIDER
})
SCHEDULING_ALGORITHM_PROVIDER:
$(
yaml-quote
${
SCHEDULING_ALGORITHM_PROVIDER
})
EOF
EOF
fi
fi
if
[
-n
"
${
MAX_PODS_PER_NODE
:-}
"
]
;
then
cat
>>
$file
<<
EOF
MAX_PODS_PER_NODE:
$(
yaml-quote
${
MAX_PODS_PER_NODE
})
EOF
fi
}
}
function
sha1sum-file
()
{
function
sha1sum-file
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment