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
bfe4896b
Commit
bfe4896b
authored
Mar 04, 2016
by
Abhi Shah
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22043 from roberthbailey/cluster-name
Add the GCE cluster name to instance metadata
parents
05ba8ca7
30b78e4d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
11 deletions
+24
-11
common.sh
cluster/common.sh
+9
-0
config-default.sh
cluster/gce/config-default.sh
+1
-0
config-test.sh
cluster/gce/config-test.sh
+1
-0
helper.sh
cluster/gce/coreos/helper.sh
+3
-2
helper.sh
cluster/gce/debian/helper.sh
+3
-2
helper.sh
cluster/gce/trusty/helper.sh
+3
-2
util.sh
cluster/gce/util.sh
+4
-5
No files found.
cluster/common.sh
View file @
bfe4896b
...
...
@@ -427,6 +427,15 @@ function build-runtime-config() {
:
}
# Writes the cluster name into a temporary file.
# Assumed vars
# CLUSTER_NAME
function
write-cluster-name
{
cat
>
"
${
KUBE_TEMP
}
/cluster-name.txt"
<<
EOF
${
CLUSTER_NAME
}
EOF
}
function
write-master-env
{
# If the user requested that the master be part of the cluster, set the
# environment variable to program the master kubelet to register itself.
...
...
cluster/gce/config-default.sh
View file @
bfe4896b
...
...
@@ -41,6 +41,7 @@ RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5}
NETWORK
=
${
KUBE_GCE_NETWORK
:-
default
}
INSTANCE_PREFIX
=
"
${
KUBE_GCE_INSTANCE_PREFIX
:-
kubernetes
}
"
CLUSTER_NAME
=
"
${
CLUSTER_NAME
:-${
INSTANCE_PREFIX
}}
"
MASTER_NAME
=
"
${
INSTANCE_PREFIX
}
-master"
MASTER_TAG
=
"
${
INSTANCE_PREFIX
}
-master"
NODE_TAG
=
"
${
INSTANCE_PREFIX
}
-minion"
...
...
cluster/gce/config-test.sh
View file @
bfe4896b
...
...
@@ -41,6 +41,7 @@ RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5}
NETWORK
=
${
KUBE_GCE_NETWORK
:-
e2e
}
INSTANCE_PREFIX
=
"
${
KUBE_GCE_INSTANCE_PREFIX
:-
e2e
-test-
${
USER
}}
"
CLUSTER_NAME
=
"
${
CLUSTER_NAME
:-${
INSTANCE_PREFIX
}}
"
MASTER_NAME
=
"
${
INSTANCE_PREFIX
}
-master"
MASTER_TAG
=
"
${
INSTANCE_PREFIX
}
-master"
NODE_TAG
=
"
${
INSTANCE_PREFIX
}
-minion"
...
...
cluster/gce/coreos/helper.sh
View file @
bfe4896b
...
...
@@ -25,7 +25,8 @@ function create-node-instance-template() {
"kube-env=
${
KUBE_TEMP
}
/node-kube-env.yaml"
\
"user-data=
${
KUBE_ROOT
}
/cluster/gce/coreos/node.yaml"
\
"configure-node=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-node.sh"
\
"configure-kubelet=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-kubelet.sh"
"configure-kubelet=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-kubelet.sh"
\
"cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt"
}
...
...
@@ -64,7 +65,7 @@ function create-master-instance() {
--scopes
"storage-ro,compute-rw,monitoring,logging-write"
\
--can-ip-forward
\
--metadata-from-file
\
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,user-data=
${
KUBE_ROOT
}
/cluster/gce/coreos/master.yaml,configure-node=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-node.sh,configure-kubelet=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-kubelet.sh"
\
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,user-data=
${
KUBE_ROOT
}
/cluster/gce/coreos/master.yaml,configure-node=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-node.sh,configure-kubelet=
${
KUBE_ROOT
}
/cluster/gce/coreos/configure-kubelet.sh
,cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt
"
\
--disk
"name=
${
MASTER_NAME
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
\
${
preemptible_master
}
}
cluster/gce/debian/helper.sh
View file @
bfe4896b
...
...
@@ -51,7 +51,7 @@ function create-master-instance {
--scopes
"storage-ro,compute-rw,monitoring,logging-write"
\
--can-ip-forward
\
--metadata-from-file
\
"startup-script=
${
KUBE_ROOT
}
/cluster/gce/configure-vm.sh,kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml"
\
"startup-script=
${
KUBE_ROOT
}
/cluster/gce/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"
\
${
preemptible_master
}
}
...
...
@@ -61,5 +61,6 @@ function create-node-instance-template {
local
template_name
=
"
$1
"
create-node-template
"
$template_name
"
"
${
scope_flags
}
"
\
"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"
\
"cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt"
}
cluster/gce/trusty/helper.sh
View file @
bfe4896b
...
...
@@ -29,7 +29,8 @@ function create-node-instance-template {
create-node-template
"
$template_name
"
"
${
scope_flags
[*]
}
"
\
"kube-env=
${
KUBE_TEMP
}
/node-kube-env.yaml"
\
"user-data=
${
KUBE_ROOT
}
/cluster/gce/trusty/node.yaml"
\
"configure-sh=
${
KUBE_ROOT
}
/cluster/gce/trusty/configure.sh"
"configure-sh=
${
KUBE_ROOT
}
/cluster/gce/trusty/configure.sh"
\
"cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt"
}
# create-master-instance creates the master instance. If called with
...
...
@@ -62,6 +63,6 @@ function create-master-instance {
--scopes
"storage-ro,compute-rw,monitoring,logging-write"
\
--can-ip-forward
\
--metadata-from-file
\
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,user-data=
${
KUBE_ROOT
}
/cluster/gce/trusty/master.yaml,configure-sh=
${
KUBE_ROOT
}
/cluster/gce/trusty/configure.sh"
\
"kube-env=
${
KUBE_TEMP
}
/master-kube-env.yaml,user-data=
${
KUBE_ROOT
}
/cluster/gce/trusty/master.yaml,configure-sh=
${
KUBE_ROOT
}
/cluster/gce/trusty/configure.sh
,cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt
"
\
--disk
"name=
${
MASTER_NAME
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
}
cluster/gce/util.sh
View file @
bfe4896b
...
...
@@ -268,7 +268,7 @@ function detect-node-names {
done
echo
"INSTANCE_GROUPS=
${
INSTANCE_GROUPS
[*]
}
"
>
&2
echo
"NODE_NAMES=
${
NODE_NAMES
[*]
}
"
>
&2
else
else
echo
"INSTANCE_GROUPS="
>
&2
echo
"NODE_NAMES="
>
&2
fi
...
...
@@ -393,9 +393,7 @@ function get-template-name-from-version {
# Robustly try to create an instance template.
# $1: The name of the instance template.
# $2: The scopes flag.
# $3: The minion start script metadata from file.
# $4: The kube-env metadata.
# $5 and others: Additional user defined metadata.
# $3 and others: Metadata entries (must all be from a file).
function
create-node-template
{
detect-project
local
template_name
=
"
$1
"
...
...
@@ -530,6 +528,7 @@ function kube-up {
else
check-existing
create-network
write-cluster-name
create-master
create-nodes-firewall
create-nodes-template
...
...
@@ -670,7 +669,7 @@ function create-nodes-template() {
# Assumes:
# - MAX_INSTANCES_PER_MIG
# - NUM_NODES
# exports:
# exports:
# - NUM_MIGS
function
set_num_migs
()
{
local
defaulted_max_instances_per_mig
=
${
MAX_INSTANCES_PER_MIG
:-
500
}
...
...
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