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
35d59e62
Commit
35d59e62
authored
Jan 29, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3851 from satnam6502/bigcluster
Generate IP addresses for minions of large GCE clusters
parents
d01ea11a
72c18200
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
config-default.sh
cluster/gce/config-default.sh
+41
-1
No files found.
cluster/gce/config-default.sh
View file @
35d59e62
...
...
@@ -34,8 +34,48 @@ MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_TAG
=
"
${
INSTANCE_PREFIX
}
-master"
MINION_TAG
=
"
${
INSTANCE_PREFIX
}
-minion"
MINION_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_MINIONS
}
}
)
)
# Compute IP addresses for nodes.
function
increment_ipv4
{
local
ip_base
=
$1
local
incr_amount
=
$2
local
-a
ip_components
local
ip_regex
=
"([0-9]+).([0-9]+).([0-9]+).([0-9]+)"
[[
$ip_base
=
~
$ip_regex
]]
ip_components
=(
"
${
BASH_REMATCH
[1]
}
"
"
${
BASH_REMATCH
[2]
}
"
"
${
BASH_REMATCH
[3]
}
"
"
${
BASH_REMATCH
[4]
}
"
)
ip_dec
=
0
local
comp
for
comp
in
"
${
ip_components
[@]
}
"
;
do
ip_dec
=
$((
ip_dec
<<
8
))
ip_dec=
$((
ip_dec
+
$comp
))
done
ip_dec=
$((
ip_dec
+
$incr_amount
))
ip_components=()
local i
for ((i=0; i < 4; i++)); do
comp=
$((
ip_dec
&
0
xFF
))
ip_components+=(
$comp
)
ip_dec=
$((
ip_dec>>8
))
done
echo "
${
ip_components
[3]
}
.
${
ip_components
[2]
}
.
${
ip_components
[1]
}
.
${
ip_components
[0]
}
"
}
node_count="
${
NUM_MINIONS
}
"
next_node="10.244.0.0"
node_subnet_size=24
node_subnet_count=
$((
2
**
(
32
-
$node_subnet_size
))
)
subnets=()
for ((node_num=0; node_num<node_count; node_num++)); do
subnets+=("
$next_node
"/"
${
node_subnet_size
}
")
next_node=
$(
increment_ipv4
$next_node
$node_subnet_count
)
done
CLUSTER_IP_RANGE="10.244.0.0/16"
MINION_IP_RANGES
=(
$(
eval echo
"10.244.{1..
${
NUM_MINIONS
}
}.0/24"
)
)
MINION_IP_RANGES=(
$(
eval echo
"
${
subnets
[@]
}
"
)
)
MINION_SCOPES=("storage-ro" "compute-rw")
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
POLL_SLEEP_INTERVAL=3
...
...
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