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
2bea4f7d
Commit
2bea4f7d
authored
Sep 06, 2017
by
Nick Sardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fall back to network if subnet is unknown
parent
7be29bd9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
26 deletions
+51
-26
master-helper.sh
cluster/gce/container-linux/master-helper.sh
+1
-1
master-helper.sh
cluster/gce/gci/master-helper.sh
+1
-1
upgrade.sh
cluster/gce/upgrade.sh
+1
-0
util.sh
cluster/gce/util.sh
+48
-24
No files found.
cluster/gce/container-linux/master-helper.sh
View file @
2bea4f7d
...
...
@@ -80,7 +80,7 @@ function create-master-instance-internal() {
fi
local
network
=
$(
make-gcloud-network-argument
\
"
${
NETWORK_PROJECT
}
"
"
${
REGION
}
"
"
${
NETWORK
}
"
"
${
SUBNETWORK
}
"
\
"
${
NETWORK_PROJECT
}
"
"
${
REGION
}
"
"
${
NETWORK
}
"
"
${
SUBNETWORK
:-
}
"
\
"
${
address
:-}
"
"
${
ENABLE_IP_ALIASES
:-}
"
"
${
IP_ALIAS_SIZE
:-}
"
)
local
metadata
=
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml"
...
...
cluster/gce/gci/master-helper.sh
View file @
2bea4f7d
...
...
@@ -89,7 +89,7 @@ function create-master-instance-internal() {
fi
local
network
=
$(
make-gcloud-network-argument
\
"
${
NETWORK_PROJECT
}
"
"
${
REGION
}
"
"
${
NETWORK
}
"
"
${
SUBNETWORK
}
"
\
"
${
NETWORK_PROJECT
}
"
"
${
REGION
}
"
"
${
NETWORK
}
"
"
${
SUBNETWORK
:-
}
"
\
"
${
address
:-}
"
"
${
ENABLE_IP_ALIASES
:-}
"
"
${
IP_ALIAS_SIZE
:-}
"
)
local
metadata
=
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml"
...
...
cluster/gce/upgrade.sh
View file @
2bea4f7d
...
...
@@ -196,6 +196,7 @@ function wait-for-master() {
function
prepare-upgrade
()
{
kube::util::ensure-temp-dir
detect-project
detect-subnetworks
detect-node-names
# sets INSTANCE_GROUPS
write-cluster-name
tars_from_version
...
...
cluster/gce/util.sh
View file @
2bea4f7d
...
...
@@ -511,7 +511,7 @@ function make-gcloud-network-argument() {
local
alias_size
=
"
$7
"
# optional
local
networkURL
=
"projects/
${
network_project
}
/global/networks/
${
network
}
"
local
subnetURL
=
"projects/
${
network_project
}
/regions/
${
region
}
/subnetworks/
${
subnet
}
"
local
subnetURL
=
"projects/
${
network_project
}
/regions/
${
region
}
/subnetworks/
${
subnet
:-
}
"
local
ret
=
""
...
...
@@ -524,8 +524,12 @@ function make-gcloud-network-argument() {
ret
=
"
${
ret
}
,aliases=pods-default:
${
alias_size
}
"
ret
=
"
${
ret
}
--no-can-ip-forward"
else
ret
=
"
${
ret
}
--network
${
networkURL
}
"
ret
=
"
${
ret
}
--subnet
${
subnetURL
}
"
if
[[
-n
${
subnet
:-}
]]
;
then
ret
=
"
${
ret
}
--subnet
${
subnetURL
}
"
else
ret
=
"
${
ret
}
--network
${
networkURL
}
"
fi
ret
=
"
${
ret
}
--can-ip-forward"
if
[[
-n
${
address
:-}
]]
;
then
ret
=
"
${
ret
}
--address
${
address
}
"
...
...
@@ -547,6 +551,7 @@ function get-template-name-from-version() {
# $3: String of comma-separated metadata entries (must all be from a file).
function
create-node-template
()
{
detect-project
detect-subnetworks
local
template_name
=
"
$1
"
# First, ensure the template doesn't exist.
...
...
@@ -595,7 +600,7 @@ function create-node-template() {
"
${
NETWORK_PROJECT
}
"
\
"
${
REGION
}
"
\
"
${
NETWORK
}
"
\
"
${
SUBNETWORK
}
"
\
"
${
SUBNETWORK
:-
}
"
\
""
\
"
${
ENABLE_IP_ALIASES
:-}
"
\
"
${
IP_ALIAS_SIZE
:-}
"
)
...
...
@@ -715,6 +720,7 @@ function kube-up() {
detect-master
parse-master-env
create-subnetworks
detect-subnetworks
create-nodes
elif
[[
${
KUBE_REPLICATE_EXISTING_MASTER
:-}
==
"true"
]]
;
then
if
[[
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"gci"
&&
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"debian"
&&
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"ubuntu"
]]
;
then
...
...
@@ -731,6 +737,7 @@ function kube-up() {
check-existing
create-network
create-subnetworks
detect-subnetworks
write-cluster-name
create-autoscaler-config
create-master
...
...
@@ -815,23 +822,7 @@ function expand-default-subnetwork() {
--quiet
}
# Vars set:
# SUBNETWORK
function
create-subnetworks
()
{
SUBNETWORK
=
$(
gcloud beta compute networks subnets list
\
--network
=
${
NETWORK
}
\
--regions
=
${
REGION
}
\
--project
=
${
NETWORK_PROJECT
}
\
--limit
=
1
\
--format
=
'value(name)'
2>/dev/null
)
if
[[
-z
${
SUBNETWORK
:-}
]]
;
then
echo
"
${
color_red
}
Could not find subnetwork with region
${
REGION
}
, network
${
NETWORK
}
, and project
${
NETWORK_PROJECT
}
"
exit
1
fi
echo
"Found subnet for region
${
REGION
}
in network
${
NETWORK
}
:
${
SUBNETWORK
}
"
case
${
ENABLE_IP_ALIASES
}
in
true
)
echo
"IP aliases are enabled. Creating subnetworks."
;;
false
)
...
...
@@ -848,9 +839,6 @@ function create-subnetworks() {
exit
1
;;
esac
SUBNETWORK
=
${
IP_ALIAS_SUBNETWORK
}
echo
"Using IP Alias subnet
${
SUBNETWORK
}
"
# Look for the alias subnet, it must exist and have a secondary
# range configured.
local
subnet
=
$(
gcloud beta compute networks subnets describe
\
...
...
@@ -888,6 +876,42 @@ function create-subnetworks() {
fi
}
# detect-subnetworks sets the SUBNETWORK var if not already set
# Assumed vars:
# NETWORK
# REGION
# NETWORK_PROJECT
#
# Optional vars:
# SUBNETWORK
# IP_ALIAS_SUBNETWORK
function
detect-subnetworks
()
{
if
[[
-n
${
SUBNETWORK
:-}
]]
;
then
echo
"Using subnet
${
SUBNETWORK
}
"
return
0
fi
if
[[
-n
${
IP_ALIAS_SUBNETWORK
:-}
]]
;
then
SUBNETWORK
=
${
IP_ALIAS_SUBNETWORK
}
echo
"Using IP Alias subnet
${
SUBNETWORK
}
"
return
0
fi
SUBNETWORK
=
$(
gcloud beta compute networks subnets list
\
--network
=
${
NETWORK
}
\
--regions
=
${
REGION
}
\
--project
=
${
NETWORK_PROJECT
}
\
--limit
=
1
\
--format
=
'value(name)'
2>/dev/null
)
if
[[
-n
${
SUBNETWORK
:-}
]]
;
then
echo
"Found subnet for region
${
REGION
}
in network
${
NETWORK
}
:
${
SUBNETWORK
}
"
return
0
fi
echo
"
${
color_red
}
Could not find subnetwork with region
${
REGION
}
, network
${
NETWORK
}
, and project
${
NETWORK_PROJECT
}
"
}
function
delete-firewall-rules
()
{
for
fw
in
$@
;
do
if
[[
-n
$(
gcloud compute firewall-rules
--project
"
${
NETWORK_PROJECT
}
"
describe
"
${
fw
}
"
--format
=
'value(name)'
2>/dev/null
||
true
)
]]
;
then
...
...
@@ -1322,7 +1346,7 @@ function create-heapster-node() {
"
${
NETWORK_PROJECT
}
"
\
"
${
REGION
}
"
\
"
${
NETWORK
}
"
"
${
SUBNETWORK
}
"
\
"
${
SUBNETWORK
:-
}
"
\
""
\
"
${
ENABLE_IP_ALIASES
:-}
"
\
"
${
IP_ALIAS_SIZE
:-}
"
)
...
...
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