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
5bd82ffe
Commit
5bd82ffe
authored
Jul 24, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11265 from mbforbes/gkeBashlog
Cleanup GKE bash logging
parents
078ec751
8e2f2af6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
util.sh
cluster/gke/util.sh
+16
-13
No files found.
cluster/gke/util.sh
View file @
5bd82ffe
...
@@ -29,7 +29,7 @@ source "${KUBE_ROOT}/cluster/gke/${KUBE_CONFIG_FILE:-config-default.sh}"
...
@@ -29,7 +29,7 @@ source "${KUBE_ROOT}/cluster/gke/${KUBE_CONFIG_FILE:-config-default.sh}"
# Assumed vars:
# Assumed vars:
# GCLOUD
# GCLOUD
function
prepare-e2e
()
{
function
prepare-e2e
()
{
echo
"... in prepare-e2e()"
>
&2
echo
"... in
gke:
prepare-e2e()"
>
&2
# Ensure GCLOUD is set to some gcloud binary.
# Ensure GCLOUD is set to some gcloud binary.
if
[[
-z
"
${
GCLOUD
:-}
"
]]
;
then
if
[[
-z
"
${
GCLOUD
:-}
"
]]
;
then
...
@@ -48,7 +48,7 @@ function prepare-e2e() {
...
@@ -48,7 +48,7 @@ function prepare-e2e() {
# Vars set:
# Vars set:
# PROJECT
# PROJECT
function
detect-project
()
{
function
detect-project
()
{
echo
"... in detect-project()"
>
&2
echo
"... in
gke:
detect-project()"
>
&2
if
[[
-z
"
${
PROJECT
:-}
"
]]
;
then
if
[[
-z
"
${
PROJECT
:-}
"
]]
;
then
export
PROJECT
=
$(
"
${
GCLOUD
}
"
config list project |
tail
-n
1 |
cut
-f
3
-d
' '
)
export
PROJECT
=
$(
"
${
GCLOUD
}
"
config list project |
tail
-n
1 |
cut
-f
3
-d
' '
)
echo
"... Using project:
${
PROJECT
}
"
>
&2
echo
"... Using project:
${
PROJECT
}
"
>
&2
...
@@ -62,13 +62,14 @@ function detect-project() {
...
@@ -62,13 +62,14 @@ function detect-project() {
# Execute prior to running tests to build a release if required for env.
# Execute prior to running tests to build a release if required for env.
function
test-build-release
()
{
function
test-build-release
()
{
echo
"... in test-build-release()"
>
&2
echo
"... in
gke:
test-build-release()"
>
&2
# We currently use the Kubernetes version that GKE supports (not testing
# We currently use the Kubernetes version that GKE supports (not testing
# bleeding-edge builds).
# bleeding-edge builds).
}
}
# Verify needed binaries exist.
# Verify needed binaries exist.
function
verify-prereqs
()
{
function
verify-prereqs
()
{
echo
"... in gke:verify-prereqs()"
>
&2
if
!
which gcloud
>
/dev/null
;
then
if
!
which gcloud
>
/dev/null
;
then
local
resp
local
resp
if
[[
"
${
KUBE_PROMPT_FOR_UPDATE
}
"
==
"y"
]]
;
then
if
[[
"
${
KUBE_PROMPT_FOR_UPDATE
}
"
==
"y"
]]
;
then
...
@@ -113,7 +114,7 @@ function verify-prereqs() {
...
@@ -113,7 +114,7 @@ function verify-prereqs() {
# NUM_MINIONS
# NUM_MINIONS
# MINION_SCOPES
# MINION_SCOPES
function
kube-up
()
{
function
kube-up
()
{
echo
"... in kube-up()"
>
&2
echo
"... in
gke:
kube-up()"
>
&2
detect-project
>
&2
detect-project
>
&2
# Make the specified network if we need to.
# Make the specified network if we need to.
...
@@ -165,7 +166,7 @@ function kube-up() {
...
@@ -165,7 +166,7 @@ function kube-up() {
# Vars set:
# Vars set:
# MINION_TAG
# MINION_TAG
function
test-setup
()
{
function
test-setup
()
{
echo
"... in test-setup()"
>
&2
echo
"... in
gke:
test-setup()"
>
&2
# Detect the project into $PROJECT if it isn't set
# Detect the project into $PROJECT if it isn't set
detect-project
>
&2
detect-project
>
&2
detect-minions
>
&2
detect-minions
>
&2
...
@@ -199,7 +200,7 @@ function test-setup() {
...
@@ -199,7 +200,7 @@ function test-setup() {
# KUBE_USER
# KUBE_USER
# KUBE_PASSWORD
# KUBE_PASSWORD
function
get-password
()
{
function
get-password
()
{
echo
"... in get-password()"
>
&2
echo
"... in g
ke:g
et-password()"
>
&2
detect-project
>
&2
detect-project
>
&2
KUBE_USER
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
KUBE_USER
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
...
@@ -218,7 +219,7 @@ function get-password() {
...
@@ -218,7 +219,7 @@ function get-password() {
# KUBE_MASTER
# KUBE_MASTER
# KUBE_MASTER_IP
# KUBE_MASTER_IP
function
detect-master
()
{
function
detect-master
()
{
echo
"... in detect-master()"
>
&2
echo
"... in
gke:
detect-master()"
>
&2
detect-project
>
&2
detect-project
>
&2
KUBE_MASTER
=
"k8s-
${
CLUSTER_NAME
}
-master"
KUBE_MASTER
=
"k8s-
${
CLUSTER_NAME
}
-master"
KUBE_MASTER_IP
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
KUBE_MASTER_IP
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
...
@@ -231,7 +232,7 @@ function detect-master() {
...
@@ -231,7 +232,7 @@ function detect-master() {
# Vars set:
# Vars set:
# MINION_NAMES
# MINION_NAMES
function
detect-minions
()
{
function
detect-minions
()
{
echo
"... in detect-minions()"
>
&2
echo
"... in
gke:
detect-minions()"
>
&2
detect-minion-names
detect-minion-names
}
}
...
@@ -242,6 +243,7 @@ function detect-minions() {
...
@@ -242,6 +243,7 @@ function detect-minions() {
# Vars set:
# Vars set:
# MINION_NAMES
# MINION_NAMES
function
detect-minion-names
{
function
detect-minion-names
{
echo
"... in gke:detect-minion-names()"
>
&2
detect-project
detect-project
detect-node-instance-group
detect-node-instance-group
MINION_NAMES
=(
$(
gcloud preview
--project
"
${
PROJECT
}
"
instance-groups
\
MINION_NAMES
=(
$(
gcloud preview
--project
"
${
PROJECT
}
"
instance-groups
\
...
@@ -260,6 +262,7 @@ function detect-minion-names {
...
@@ -260,6 +262,7 @@ function detect-minion-names {
# Vars set:
# Vars set:
# NODE_INSTANCE_GROUP
# NODE_INSTANCE_GROUP
function
detect-node-instance-group
{
function
detect-node-instance-group
{
echo
"... in gke:detect-node-instance-group()"
>
&2
NODE_INSTANCE_GROUP
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
NODE_INSTANCE_GROUP
=
$(
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters describe
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
\
|
grep
instanceGroupManagers |
cut
-d
'/'
-f
11
)
|
grep
instanceGroupManagers |
cut
-d
'/'
-f
11
)
...
@@ -271,7 +274,7 @@ function detect-node-instance-group {
...
@@ -271,7 +274,7 @@ function detect-node-instance-group {
# GCLOUD
# GCLOUD
# ZONE
# ZONE
function
ssh-to-node
()
{
function
ssh-to-node
()
{
echo
"... in ssh-to-node()"
>
&2
echo
"... in
gke:
ssh-to-node()"
>
&2
detect-project
>
&2
detect-project
>
&2
local
node
=
"
$1
"
local
node
=
"
$1
"
...
@@ -289,13 +292,13 @@ function ssh-to-node() {
...
@@ -289,13 +292,13 @@ function ssh-to-node() {
# Restart the kube-proxy on a node ($1)
# Restart the kube-proxy on a node ($1)
function
restart-kube-proxy
()
{
function
restart-kube-proxy
()
{
echo
"... in restart-kube-proxy()"
>
&2
echo
"... in
gke:
restart-kube-proxy()"
>
&2
ssh-to-node
"
$1
"
"sudo /etc/init.d/kube-proxy restart"
ssh-to-node
"
$1
"
"sudo /etc/init.d/kube-proxy restart"
}
}
# Restart the kube-proxy on master ($1)
# Restart the kube-proxy on master ($1)
function
restart-apiserver
()
{
function
restart-apiserver
()
{
echo
"... in
restart-kube
-apiserver()"
>
&2
echo
"... in
gke:restart
-apiserver()"
>
&2
ssh-to-node
"
$1
"
"sudo docker ps | grep /kube-apiserver | cut -d ' ' -f 1 | xargs sudo docker kill"
ssh-to-node
"
$1
"
"sudo docker ps | grep /kube-apiserver | cut -d ' ' -f 1 | xargs sudo docker kill"
}
}
...
@@ -309,7 +312,7 @@ function restart-apiserver() {
...
@@ -309,7 +312,7 @@ function restart-apiserver() {
# KUBE_ROOT
# KUBE_ROOT
# ZONE
# ZONE
function
test-teardown
()
{
function
test-teardown
()
{
echo
"... in test-teardown()"
>
&2
echo
"... in
gke:
test-teardown()"
>
&2
detect-project
>
&2
detect-project
>
&2
detect-minions
>
&2
detect-minions
>
&2
...
@@ -334,7 +337,7 @@ function test-teardown() {
...
@@ -334,7 +337,7 @@ function test-teardown() {
# ZONE
# ZONE
# CLUSTER_NAME
# CLUSTER_NAME
function
kube-down
()
{
function
kube-down
()
{
echo
"... in kube-down()"
>
&2
echo
"... in
gke:
kube-down()"
>
&2
detect-project
>
&2
detect-project
>
&2
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters delete
--project
=
"
${
PROJECT
}
"
\
"
${
GCLOUD
}
"
"
${
CMD_GROUP
}
"
container clusters delete
--project
=
"
${
PROJECT
}
"
\
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
--quiet
--zone
=
"
${
ZONE
}
"
"
${
CLUSTER_NAME
}
"
--quiet
...
...
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