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
31903c8b
Commit
31903c8b
authored
Mar 10, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22594 from justinsb/aws_ulite
Auto commit by PR queue bot
parents
1460f247
523e1d0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
2 deletions
+58
-2
util.sh
cluster/aws/util.sh
+18
-2
common.sh
cluster/common.sh
+26
-0
util.sh
cluster/gce/util.sh
+14
-0
No files found.
cluster/aws/util.sh
View file @
31903c8b
...
@@ -191,6 +191,16 @@ function detect-master() {
...
@@ -191,6 +191,16 @@ function detect-master() {
echo
"Using master:
$KUBE_MASTER
(external IP:
$KUBE_MASTER_IP
)"
echo
"Using master:
$KUBE_MASTER
(external IP:
$KUBE_MASTER_IP
)"
}
}
# Reads kube-env metadata from master
#
# Assumed vars:
# KUBE_MASTER_IP
# AWS_SSH_KEY
# SSH_USER
function
get-master-env
()
{
ssh
-oStrictHostKeyChecking
=
no
-i
"
${
AWS_SSH_KEY
}
"
${
SSH_USER
}
@
${
KUBE_MASTER_IP
}
sudo cat
/etc/kubernetes/kube_env.yaml
}
function
query-running-minions
()
{
function
query-running-minions
()
{
local
query
=
$1
local
query
=
$1
...
@@ -454,8 +464,14 @@ function authorize-security-group-ingress {
...
@@ -454,8 +464,14 @@ function authorize-security-group-ingress {
function
find-master-pd
{
function
find-master-pd
{
local
name
=
${
MASTER_NAME
}
-pd
local
name
=
${
MASTER_NAME
}
-pd
if
[[
-z
"
${
MASTER_DISK_ID
}
"
]]
;
then
if
[[
-z
"
${
MASTER_DISK_ID
}
"
]]
;
then
local
zone_filter
=
"Name=availability-zone,Values=
${
ZONE
}
"
if
[[
"
${
KUBE_USE_EXISTING_MASTER
:-}
"
==
"true"
]]
;
then
# If we're reusing an existing master, it is likely to be in another zone
# If running multizone, your cluster must be uniquely named across zones
zone_filter
=
""
fi
MASTER_DISK_ID
=
`
$AWS_CMD
describe-volumes
\
MASTER_DISK_ID
=
`
$AWS_CMD
describe-volumes
\
--filters
Name
=
availability-zone,Values
=
${
ZONE
}
\
--filters
${
zone_filter
}
\
Name
=
tag:Name,Values
=
${
name
}
\
Name
=
tag:Name,Values
=
${
name
}
\
Name
=
tag:KubernetesCluster,Values
=
${
CLUSTER_ID
}
\
Name
=
tag:KubernetesCluster,Values
=
${
CLUSTER_ID
}
\
--query
Volumes[].VolumeId
`
--query
Volumes[].VolumeId
`
...
@@ -928,8 +944,8 @@ function kube-up {
...
@@ -928,8 +944,8 @@ function kube-up {
# KUBE_USE_EXISTING_MASTER is used to add minions to an existing master
# KUBE_USE_EXISTING_MASTER is used to add minions to an existing master
if
[[
"
${
KUBE_USE_EXISTING_MASTER
:-}
"
==
"true"
]]
;
then
if
[[
"
${
KUBE_USE_EXISTING_MASTER
:-}
"
==
"true"
]]
;
then
# Detect existing master
detect-master
detect-master
parse-master-env
# Start minions
# Start minions
start-minions
start-minions
...
...
cluster/common.sh
View file @
31903c8b
...
@@ -716,3 +716,29 @@ function create-certs {
...
@@ -716,3 +716,29 @@ function create-certs {
KUBECFG_CERT_BASE64
=
$(
cat
"
${
CERT_DIR
}
/pki/issued/kubecfg.crt"
|
base64
|
tr
-d
'\r\n'
)
KUBECFG_CERT_BASE64
=
$(
cat
"
${
CERT_DIR
}
/pki/issued/kubecfg.crt"
|
base64
|
tr
-d
'\r\n'
)
KUBECFG_KEY_BASE64
=
$(
cat
"
${
CERT_DIR
}
/pki/private/kubecfg.key"
|
base64
|
tr
-d
'\r\n'
)
KUBECFG_KEY_BASE64
=
$(
cat
"
${
CERT_DIR
}
/pki/private/kubecfg.key"
|
base64
|
tr
-d
'\r\n'
)
}
}
#
# Using provided master env, extracts value from provided key.
#
# Args:
# $1 master env (kube-env of master; result of calling get-master-env)
# $2 env key to use
function
get-env-val
()
{
local
match
=
`
(
echo
"
${
1
}
"
|
grep
${
2
}
)
||
echo
""
`
if
[[
-z
${
match
}
]]
;
then
echo
""
fi
echo
${
match
}
|
cut
-d
:
-f
2 |
cut
-d
\'
-f
2
}
# Load the master env by calling get-master-env, and extract important values
function
parse-master-env
()
{
# Get required master env vars
local
master_env
=
$(
get-master-env
)
KUBELET_TOKEN
=
$(
get-env-val
"
${
master_env
}
"
"KUBELET_TOKEN"
)
KUBE_PROXY_TOKEN
=
$(
get-env-val
"
${
master_env
}
"
"KUBE_PROXY_TOKEN"
)
CA_CERT_BASE64
=
$(
get-env-val
"
${
master_env
}
"
"CA_CERT"
)
EXTRA_DOCKER_OPTS
=
$(
get-env-val
"
${
master_env
}
"
"EXTRA_DOCKER_OPTS"
)
KUBELET_CERT_BASE64
=
$(
get-env-val
"
${
master_env
}
"
"KUBELET_CERT"
)
KUBELET_KEY_BASE64
=
$(
get-env-val
"
${
master_env
}
"
"KUBELET_KEY"
)
}
cluster/gce/util.sh
View file @
31903c8b
...
@@ -337,6 +337,19 @@ function detect-master () {
...
@@ -337,6 +337,19 @@ function detect-master () {
echo
"Using master:
$KUBE_MASTER
(external IP:
$KUBE_MASTER_IP
)"
echo
"Using master:
$KUBE_MASTER
(external IP:
$KUBE_MASTER_IP
)"
}
}
# Reads kube-env metadata from master
#
# Assumed vars:
# KUBE_MASTER
# PROJECT
# ZONE
function
get-master-env
()
{
# TODO(zmerlynn): Make this more reliable with retries.
gcloud compute
--project
${
PROJECT
}
ssh
--zone
${
ZONE
}
${
KUBE_MASTER
}
--command
\
"curl --fail --silent -H 'Metadata-Flavor: Google'
\
'http://metadata/computeMetadata/v1/instance/attributes/kube-env'"
2>/dev/null
}
# Robustly try to create a static ip.
# Robustly try to create a static ip.
# $1: The name of the ip to create
# $1: The name of the ip to create
# $2: The name of the region to create the ip in.
# $2: The name of the region to create the ip in.
...
@@ -535,6 +548,7 @@ function kube-up {
...
@@ -535,6 +548,7 @@ function kube-up {
set_num_migs
set_num_migs
if
[[
${
KUBE_USE_EXISTING_MASTER
:-}
==
"true"
]]
;
then
if
[[
${
KUBE_USE_EXISTING_MASTER
:-}
==
"true"
]]
;
then
parse-master-env
create-nodes
create-nodes
create-autoscaler
create-autoscaler
else
else
...
...
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