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
196a442e
Commit
196a442e
authored
Aug 25, 2016
by
Jerzy Szczepkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented creation of HA master for GCE on debain.
Implemented creation of HA master for GCE on debain.
parent
af325ee7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
master-helper.sh
cluster/gce/debian/master-helper.sh
+38
-3
util.sh
cluster/gce/util.sh
+2
-3
No files found.
cluster/gce/debian/master-helper.sh
View file @
196a442e
...
@@ -40,8 +40,32 @@ function create-master-instance {
...
@@ -40,8 +40,32 @@ function create-master-instance {
write-master-env
write-master-env
prepare-startup-script
prepare-startup-script
gcloud compute instances create
"
${
MASTER_NAME
}
"
\
create-master-instance-internal
"
${
MASTER_NAME
}
"
"
${
address_opt
}
"
"
${
preemptible_master
}
"
${
address_opt
}
\
}
function
replicate-master-instance
()
{
local
existing_master_zone
=
"
${
1
}
"
local
existing_master_name
=
"
${
2
}
"
local
existing_master_replicas
=
"
${
3
}
"
local
kube_env
=
"
$(
get-metadata
"
${
existing_master_zone
}
"
"
${
existing_master_name
}
"
kube-env
)
"
# Substitute INITIAL_ETCD_CLUSTER to enable etcd clustering.
kube_env
=
"
$(
echo
"
${
kube_env
}
"
|
grep
-v
"INITIAL_ETCD_CLUSTER"
)
"
kube_env
=
"
$(
echo
-e
"
${
kube_env
}
\n
INITIAL_ETCD_CLUSTER: '
${
existing_master_replicas
}
,
${
REPLICA_NAME
}
'"
)
"
echo
"
${
kube_env
}
"
>
${
KUBE_TEMP
}
/master-kube-env.yaml
get-metadata
"
${
existing_master_zone
}
"
"
${
existing_master_name
}
"
cluster-name
>
${
KUBE_TEMP
}
/cluster-name.txt
get-metadata
"
${
existing_master_zone
}
"
"
${
existing_master_name
}
"
startup-script
>
${
KUBE_TEMP
}
/configure-vm.sh
create-master-instance-internal
"
${
REPLICA_NAME
}
"
}
function
create-master-instance-internal
()
{
local
-r
master_name
=
"
${
1
}
"
local
-r
address_option
=
"
${
2
:-}
"
local
-r
preemptible_master
=
"
${
3
:-}
"
gcloud compute instances create
"
${
master_name
}
"
\
${
address_option
}
\
--project
"
${
PROJECT
}
"
\
--project
"
${
PROJECT
}
"
\
--zone
"
${
ZONE
}
"
\
--zone
"
${
ZONE
}
"
\
--machine-type
"
${
MASTER_SIZE
}
"
\
--machine-type
"
${
MASTER_SIZE
}
"
\
...
@@ -53,7 +77,18 @@ function create-master-instance {
...
@@ -53,7 +77,18 @@ function create-master-instance {
--can-ip-forward
\
--can-ip-forward
\
--metadata-from-file
\
--metadata-from-file
\
"startup-script=
${
KUBE_TEMP
}
/configure-vm.sh,kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt"
\
"startup-script=
${
KUBE_TEMP
}
/configure-vm.sh,kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt"
\
--disk
"name=
${
MASTER_NAME
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
\
--disk
"name=
${
master_name
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
\
--boot-disk-size
"
${
MASTER_ROOT_DISK_SIZE
:-
10
}
"
\
--boot-disk-size
"
${
MASTER_ROOT_DISK_SIZE
:-
10
}
"
\
${
preemptible_master
}
${
preemptible_master
}
}
}
# TODO: This is most likely not the best way to read metadata from the existing master.
function
get-metadata
()
{
local
zone
=
"
${
1
}
"
local
name
=
"
${
2
}
"
local
key
=
"
${
3
}
"
gcloud compute ssh
"
${
name
}
"
\
--project
"
${
PROJECT
}
"
\
--zone
=
"
${
zone
}
"
\
--command
"curl
\"
http://metadata.google.internal/computeMetadata/v1/instance/attributes/
${
key
}
\"
-H
\"
Metadata-Flavor: Google
\"
"
2>/dev/null
}
cluster/gce/util.sh
View file @
196a442e
...
@@ -595,9 +595,8 @@ function kube-up() {
...
@@ -595,9 +595,8 @@ function kube-up() {
parse-master-env
parse-master-env
create-nodes
create-nodes
elif
[[
${
KUBE_EXPERIMENTAL_REPLICATE_EXISTING_MASTER
:-}
==
"true"
]]
;
then
elif
[[
${
KUBE_EXPERIMENTAL_REPLICATE_EXISTING_MASTER
:-}
==
"true"
]]
;
then
# TODO(jsz): implement adding replica for other distributions.
if
[[
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"gci"
&&
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"debian"
]]
;
then
if
[[
"
${
MASTER_OS_DISTRIBUTION
}
"
!=
"gci"
]]
;
then
echo
"Master replication supported only for gci and debian"
echo
"Master replication supported only for gci"
return
1
return
1
fi
fi
create-loadbalancer
create-loadbalancer
...
...
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