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
1ebf6e1a
Commit
1ebf6e1a
authored
Sep 30, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 30, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #33829 from gmarek/stop
Automatic merge from submit-queue Add a script to "stop" GKE cluster creation Fix #33749
parents
448ceb38
0f25d552
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
make-it-stop.sh
cluster/gke/make-it-stop.sh
+65
-0
No files found.
cluster/gke/make-it-stop.sh
0 → 100755
View file @
1ebf6e1a
#!/bin/bash
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
echo
"This is NOT a production-ready tool.
\n\
IT'S A HACKY, BEST-EFFORT WAY TO
\"
STOP
\"
CREATION OF THE GKE CLUSTER."
read
-n
1
-p
"Are you sure you want to proceed (y/N)?: "
decision
echo
""
if
[[
"
${
decision
}
"
!=
"y"
]]
;
then
echo
"Aborting..."
exit
0
fi
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../..
if
[
-f
"
${
KUBE_ROOT
}
/cluster/env.sh"
]
;
then
source
"
${
KUBE_ROOT
}
/cluster/env.sh"
fi
source
"
${
KUBE_ROOT
}
/cluster/gke/util.sh"
STAGING_ENDPOINT
=
"CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER=https://staging-container.sandbox.googleapis.com/"
detect-project
cluster
=
$(
gcloud container operations list
"--project=
${
PROJECT
}
"
|
grep
"CREATE_CLUSTER"
|
grep
"RUNNING"
||
true
)
if
[
-z
"
${
cluster
}
"
]
;
then
echo
"Couldn't find any cluster being created in production environment. Trying staging..."
cluster
=
$(
env
${
STAGING_ENDPOINT
}
gcloud container operations list
"--project=
${
PROJECT
}
"
|
grep
"CREATE_CLUSTER"
|
grep
"RUNNING"
||
true
)
fi
if
[
-z
"
${
cluster
}
"
]
;
then
echo
"No cluster creation in progress found. Aborting."
exit
0
fi
zone
=
$(
echo
"
${
cluster
}
"
|
tr
-s
"[:blank:]"
|
cut
-f3
-d
" "
)
cluster_name
=
$(
echo
"
${
cluster
}
"
|
tr
-s
"[:blank:]"
|
cut
-f4
-d
" "
)
gcloud
=
"gcloud"
if
[
"
${
zone
}
"
==
"us-east1-a"
]
;
then
gcloud
=
"env
${
STAGING_ENDPOINT
}
gcloud"
fi
migs
=
$(${
gcloud
}
compute instance-groups managed list
--project
=
${
PROJECT
}
--zones
=
${
zone
}
|
grep
"gke-
${
cluster_name
}
"
|
cut
-f1
-d
" "
)
echo
"Managed instance groups for cluster
${
cluster_name
}
:
${
migs
}
"
for
mig
in
${
migs
}
;
do
echo
"Resizing
${
mig
}
..."
${
gcloud
}
compute instance-groups managed resize
--project
=
"
${
PROJECT
}
"
--zone
=
"
${
zone
}
"
"
${
mig
}
"
--size
=
1
done
echo
"All managed instance groups resized to 1. Cluster creation operation should end soon, and you will be be able to delete the cluster."
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