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
20bace87
Commit
20bace87
authored
Jan 17, 2018
by
Bowei Du
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Zones to use generated code
parent
fcff8bcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
gce_zones.go
pkg/cloudprovider/providers/gce/gce_zones.go
+4
-4
No files found.
pkg/cloudprovider/providers/gce/gce_zones.go
View file @
20bace87
...
...
@@ -17,13 +17,14 @@ limitations under the License.
package
gce
import
(
"
fm
t"
"
contex
t"
"strings"
compute
"google.golang.org/api/compute/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce/cloud/filter"
)
func
newZonesMetricContext
(
request
,
region
string
)
*
metricContext
{
...
...
@@ -72,12 +73,11 @@ func (gce *GCECloud) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Z
// ListZonesInRegion returns all zones in a GCP region
func
(
gce
*
GCECloud
)
ListZonesInRegion
(
region
string
)
([]
*
compute
.
Zone
,
error
)
{
mc
:=
newZonesMetricContext
(
"list"
,
region
)
filter
:=
fmt
.
Sprintf
(
"region eq %v"
,
gce
.
getRegionLink
(
region
))
list
,
err
:=
gce
.
service
.
Zones
.
List
(
gce
.
projectID
)
.
Filter
(
filter
)
.
Do
()
list
,
err
:=
gce
.
c
.
Zones
()
.
List
(
context
.
Background
(),
filter
.
Regexp
(
"region"
,
gce
.
getRegionLink
(
region
)))
if
err
!=
nil
{
return
nil
,
mc
.
Observe
(
err
)
}
return
list
.
Items
,
mc
.
Observe
(
err
)
return
list
,
mc
.
Observe
(
err
)
}
func
(
gce
*
GCECloud
)
getRegionLink
(
region
string
)
string
{
...
...
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