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
2128d4e2
Commit
2128d4e2
authored
Apr 24, 2015
by
Dawn Chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7261 from erictune/kube_env
Pass KUBELET_TOKEN in kube-env metadata.
parents
35e9ad17
e8a83b23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
22 deletions
+5
-22
configure-vm.sh
cluster/gce/configure-vm.sh
+0
-14
util.sh
cluster/gce/util.sh
+5
-8
No files found.
cluster/gce/configure-vm.sh
View file @
2128d4e2
...
@@ -73,19 +73,6 @@ for k,v in yaml.load(sys.stdin).iteritems():
...
@@ -73,19 +73,6 @@ for k,v in yaml.load(sys.stdin).iteritems():
fi
fi
}
}
function
ensure-kube-token
()
{
# We bake the KUBELET_TOKEN in separately to avoid auth information
# having to be re-communicated on kube-push. (Otherwise the client
# has to keep the bearer token around to handle generating a valid
# kube-env.)
if
[[
-z
"
${
KUBELET_TOKEN
:-}
"
]]
&&
[[
!
-e
"
${
KNOWN_TOKENS_FILE
}
"
]]
;
then
until
KUBELET_TOKEN
=
$(
curl-metadata kube-token
)
;
do
echo
'Waiting for metadata KUBELET_TOKEN...'
sleep
3
done
fi
}
function
remove-docker-artifacts
()
{
function
remove-docker-artifacts
()
{
echo
"== Deleting docker0 =="
echo
"== Deleting docker0 =="
# Forcibly install bridge-utils (options borrowed from Salt logs).
# Forcibly install bridge-utils (options borrowed from Salt logs).
...
@@ -416,7 +403,6 @@ if [[ -z "${is_push}" ]]; then
...
@@ -416,7 +403,6 @@ if [[ -z "${is_push}" ]]; then
ensure-install-dir
ensure-install-dir
set-kube-env
set-kube-env
[[
"
${
KUBERNETES_MASTER
}
"
==
"true"
]]
&&
mount-master-pd
[[
"
${
KUBERNETES_MASTER
}
"
==
"true"
]]
&&
mount-master-pd
ensure-kube-token
create-salt-pillar
create-salt-pillar
create-salt-auth
create-salt-auth
download-release
download-release
...
...
cluster/gce/util.sh
View file @
2128d4e2
...
@@ -358,7 +358,6 @@ function create-route {
...
@@ -358,7 +358,6 @@ function create-route {
# $2: The scopes flag.
# $2: The scopes flag.
# $3: The minion start script metadata from file.
# $3: The minion start script metadata from file.
# $4: The kube-env metadata.
# $4: The kube-env metadata.
# $5: Raw metadata
function
create-node-template
{
function
create-node-template
{
detect-project
detect-project
local
attempt
=
0
local
attempt
=
0
...
@@ -374,8 +373,7 @@ function create-node-template {
...
@@ -374,8 +373,7 @@ function create-node-template {
--network
"
${
NETWORK
}
"
\
--network
"
${
NETWORK
}
"
\
$2
\
$2
\
--can-ip-forward
\
--can-ip-forward
\
--metadata-from-file
"
$3
"
"
$4
"
\
--metadata-from-file
"
$3
"
"
$4
"
;
then
--metadata
"
$5
"
;
then
if
((
attempt
>
5
))
;
then
if
((
attempt
>
5
))
;
then
echo
-e
"
${
color_red
}
Failed to create instance template
$1
${
color_norm
}
"
echo
-e
"
${
color_red
}
Failed to create instance template
$1
${
color_norm
}
"
exit
2
exit
2
...
@@ -474,6 +472,7 @@ DNS_REPLICAS: $(yaml-quote ${DNS_REPLICAS:-})
...
@@ -474,6 +472,7 @@ DNS_REPLICAS: $(yaml-quote ${DNS_REPLICAS:-})
DNS_SERVER_IP:
$(
yaml-quote
${
DNS_SERVER_IP
:-})
DNS_SERVER_IP:
$(
yaml-quote
${
DNS_SERVER_IP
:-})
DNS_DOMAIN:
$(
yaml-quote
${
DNS_DOMAIN
:-})
DNS_DOMAIN:
$(
yaml-quote
${
DNS_DOMAIN
:-})
KUBE_BEARER_TOKEN:
$(
yaml-quote
${
KUBE_BEARER_TOKEN
})
KUBE_BEARER_TOKEN:
$(
yaml-quote
${
KUBE_BEARER_TOKEN
})
KUBELET_TOKEN:
$(
yaml-quote
${
KUBELET_TOKEN
:-})
ADMISSION_CONTROL:
$(
yaml-quote
${
ADMISSION_CONTROL
:-})
ADMISSION_CONTROL:
$(
yaml-quote
${
ADMISSION_CONTROL
:-})
MASTER_IP_RANGE:
$(
yaml-quote
${
MASTER_IP_RANGE
})
MASTER_IP_RANGE:
$(
yaml-quote
${
MASTER_IP_RANGE
})
EOF
EOF
...
@@ -614,7 +613,6 @@ function kube-up {
...
@@ -614,7 +613,6 @@ function kube-up {
# Wait for last batch of jobs
# Wait for last batch of jobs
wait-for-jobs
wait-for-jobs
add-instance-metadata
"
${
MASTER_NAME
}
"
"kube-token=
${
KUBELET_TOKEN
}
"
echo
"Creating minions."
echo
"Creating minions."
...
@@ -628,8 +626,7 @@ function kube-up {
...
@@ -628,8 +626,7 @@ function kube-up {
write-node-env
write-node-env
create-node-template
"
${
NODE_INSTANCE_PREFIX
}
-template"
"
${
scope_flags
[*]
}
"
\
create-node-template
"
${
NODE_INSTANCE_PREFIX
}
-template"
"
${
scope_flags
[*]
}
"
\
"startup-script=
${
KUBE_ROOT
}
/cluster/gce/configure-vm.sh"
\
"startup-script=
${
KUBE_ROOT
}
/cluster/gce/configure-vm.sh"
\
"kube-env=
${
KUBE_TEMP
}
/node-kube-env.yaml"
\
"kube-env=
${
KUBE_TEMP
}
/node-kube-env.yaml"
"kube-token=
${
KUBELET_TOKEN
}
"
gcloud preview managed-instance-groups
--zone
"
${
ZONE
}
"
\
gcloud preview managed-instance-groups
--zone
"
${
ZONE
}
"
\
create
"
${
NODE_INSTANCE_PREFIX
}
-group"
\
create
"
${
NODE_INSTANCE_PREFIX
}
-group"
\
...
@@ -867,8 +864,8 @@ function kube-push {
...
@@ -867,8 +864,8 @@ function kube-push {
# TODO(zmerlynn): Re-create instance-template with the new
# TODO(zmerlynn): Re-create instance-template with the new
# node-kube-env. This isn't important until the node-ip-range issue
# node-kube-env. This isn't important until the node-ip-range issue
# is solved (because that's blocking automatic dynamic nodes from
# is solved (because that's blocking automatic dynamic nodes from
# working). The node-kube-env has to be composed with the
kube-token
# working). The node-kube-env has to be composed with the
KUBELET_TOKEN
#
metadata.
Ideally we would have
# Ideally we would have
# https://github.com/GoogleCloudPlatform/kubernetes/issues/3168
# https://github.com/GoogleCloudPlatform/kubernetes/issues/3168
# implemented before then, though, so avoiding this mess until then.
# implemented before then, though, so avoiding this mess until then.
...
...
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