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
a781bd6b
Commit
a781bd6b
authored
Dec 18, 2014
by
Joe Beda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3008 from cjcullen/deploy
Only create a single firewall rule for all minions.
parents
a781c022
90364b30
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
23 deletions
+11
-23
config-default.sh
cluster/gce/config-default.sh
+1
-0
config-test.sh
cluster/gce/config-test.sh
+1
-0
util.sh
cluster/gce/util.sh
+9
-23
No files found.
cluster/gce/config-default.sh
View file @
a781bd6b
...
...
@@ -32,6 +32,7 @@ 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
}
}
)
)
CLUSTER_IP_RANGE
=
"10.244.0.0/16"
MINION_IP_RANGES
=(
$(
eval echo
"10.244.{1..
${
NUM_MINIONS
}
}.0/24"
)
)
MINION_SCOPES
=(
"storage-ro"
"compute-rw"
)
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
...
...
cluster/gce/config-test.sh
View file @
a781bd6b
...
...
@@ -32,6 +32,7 @@ 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
}
}
)
)
CLUSTER_IP_RANGE
=
"10.245.0.0/16"
MINION_IP_RANGES
=(
$(
eval echo
"10.245.{1..
${
NUM_MINIONS
}
}.0/24"
)
)
MINION_SCOPES
=(
"storage-ro"
"compute-rw"
)
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
...
...
cluster/gce/util.sh
View file @
a781bd6b
...
...
@@ -249,6 +249,7 @@ function wait-for-jobs {
# Robustly try to create a firewall rule.
# $1: The name of firewall rule.
# $2: IP ranges.
# $3: Target tags for this firewall rule.
function
create-firewall-rule
{
local
attempt
=
0
while
true
;
do
...
...
@@ -256,6 +257,7 @@ function create-firewall-rule {
--project
"
${
PROJECT
}
"
\
--network
"
${
NETWORK
}
"
\
--source-ranges
"
$2
"
\
--target-tags
"
$3
"
\
--allow
tcp udp icmp esp ah sctp
;
then
if
((
attempt
>
5
))
;
then
echo
-e
"
${
color_red
}
Failed to create firewall rule
$1
${
color_norm
}
"
...
...
@@ -416,16 +418,9 @@ function kube-up {
--scopes
"storage-ro"
"compute-rw"
\
--metadata-from-file
"startup-script=
${
KUBE_TEMP
}
/master-start.sh"
&
# Create the firewall rules, 10 at a time.
for
((
i
=
0
;
i<
${#
MINION_NAMES
[@]
}
;
i++
))
;
do
create-firewall-rule
"
${
MINION_NAMES
[
$i
]
}
-all"
"
${
MINION_IP_RANGES
[
$i
]
}
"
&
if
[
$i
-ne
0
]
&&
[
$((
i%10
))
-eq
0
]
;
then
echo
Waiting
for
a batch of firewall rules at
$i
...
wait-for-jobs
fi
# Create a single firewall rule for all minions.
create-firewall-rule
"
${
MINION_TAG
}
-all"
"
${
CLUSTER_IP_RANGE
}
"
"
${
MINION_TAG
}
"
&
done
# Wait for last batch of jobs.
wait-for-jobs
...
...
@@ -613,20 +608,11 @@ function kube-down {
--quiet
\
"
${
MASTER_NAME
}
-https"
||
true
# Delete firewall rules for minions.
# TODO(satnam6502): Adjust this if we move to just one big firewall rule.\
local
-a
firewall_rules
firewall_rules
=(
$(
gcloud compute firewall-rules list
--project
"
${
PROJECT
}
"
\
--regexp
"
${
INSTANCE_PREFIX
}
-minion-[0-9]+-all"
\
|
awk
'NR >= 2 { print $1 }'
)
)
while
((
"
${#
firewall_rules
[@]
}
"
>
0
))
;
do
echo
Deleting firewall rules
"
${
firewall_rules
[*]
::10
}
"
gcloud compute firewall-rules delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
firewall_rules
[@]
::10
}
"
||
true
firewall_rules
=(
"
${
firewall_rules
[@]
:10
}
"
)
done
# Delete firewall rule for minions.
gcloud compute firewall-rules delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
MINION_TAG
}
-all"
||
true
# Delete routes.
local
-a
routes
...
...
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