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
574f354b
Commit
574f354b
authored
Jan 28, 2016
by
Fabio Yeon
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20143 from roberthbailey/list-resources-gke
Fix list-resources.sh to work with the GKE provider
parents
70ff0bda
a8cad507
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
list-resources.sh
cluster/gce/list-resources.sh
+10
-3
No files found.
cluster/gce/list-resources.sh
View file @
574f354b
...
...
@@ -31,6 +31,13 @@ REGION=${ZONE%-*}
INSTANCE_PREFIX
=
${
KUBE_GCE_INSTANCE_PREFIX
:-${
CLUSTER_NAME
:-}}
NETWORK
=
${
KUBE_GCE_NETWORK
:-${
KUBE_GKE_NETWORK
:-}}
# In GKE the instance prefix starts with "gke-".
if
[[
"
${
KUBERNETES_PROVIDER
:-}
"
==
"gke"
]]
;
then
INSTANCE_PREFIX
=
"gke-
${
CLUSTER_NAME
}
"
# Truncate to 26 characters for route prefix matching.
INSTANCE_PREFIX
=
"
${
INSTANCE_PREFIX
:0:26
}
"
fi
# Usage: gcloud-compute-list <resource> <additional parameters to gcloud...>
# GREP_REGEX is applied to the output of gcloud if set
GREP_REGEX
=
""
...
...
@@ -40,7 +47,6 @@ function gcloud-compute-list() {
local
attempt
=
1
local
result
=
""
while
true
;
do
echo
"Attempt
${
attempt
}
to list
${
resource
}
in GCE"
if
result
=
$(
gcloud compute
${
resource
}
list
--project
=
${
PROJECT
}
${
@
:2
}
|
grep
"
${
GREP_REGEX
}
"
)
;
then
echo
"
${
result
}
"
return
...
...
@@ -59,7 +65,8 @@ echo "Project: ${PROJECT}"
echo
"Region:
${
REGION
}
"
echo
"Zone:
${
ZONE
}
"
echo
"Instance prefix:
${
INSTANCE_PREFIX
:-}
"
echo
"Network:
${
NETWORK
:-}
"
echo
"Network:
${
NETWORK
}
"
echo
"Provider:
${
KUBERNETES_PROVIDER
:-}
"
# List resources related to instances, filtering by the instance prefix if
# provided.
...
...
@@ -75,7 +82,7 @@ gcloud-compute-list disks ${ZONE:+"--zone=${ZONE}"} --regexp="${INSTANCE_PREFIX}
gcloud-compute-list addresses
${
REGION
:+
"--region=
${
REGION
}
"
}
--regexp
=
"a.*|
${
INSTANCE_PREFIX
}
.*"
# Match either the header or a line with the specified e2e network.
# This assumes that the network name is the second field in the output.
GREP_REGEX
=
"^NAME
\|
^[^
\s
]
\+\s\+\(
default
\|
${
NETWORK
}
\)\s
"
GREP_REGEX
=
"^NAME
\|
^[^
]
\+
[ ]
\+\(
default
\|
${
NETWORK
}
\)
"
gcloud-compute-list routes
--regexp
=
"default.*|
${
INSTANCE_PREFIX
}
.*"
gcloud-compute-list firewall-rules
--regexp
=
"default.*|k8s-fw.*|
${
INSTANCE_PREFIX
}
.*"
GREP_REGEX
=
""
...
...
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