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
cc5b177d
Commit
cc5b177d
authored
Jul 15, 2019
by
Hantao (Will) Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move getInstancesByName logic to helper function
parent
859e2339
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
gce_instances.go
...ng/src/k8s.io/legacy-cloud-providers/gce/gce_instances.go
+22
-0
No files found.
staging/src/k8s.io/legacy-cloud-providers/gce/gce_instances.go
View file @
cc5b177d
...
...
@@ -426,6 +426,28 @@ func (g *Cloud) AddAliasToInstance(nodeName types.NodeName, alias *net.IPNet) er
// Gets the named instances, returning cloudprovider.InstanceNotFound if any
// instance is not found
func
(
g
*
Cloud
)
getInstancesByNames
(
names
[]
string
)
([]
*
gceInstance
,
error
)
{
instanceOrErrors
,
err
:=
g
.
getInstanceOrErrorsByNames
(
names
)
if
err
!=
nil
{
return
nil
,
err
}
var
allInstances
[]
*
gceInstance
for
_
,
entry
:=
range
instanceOrErrors
{
if
entry
.
err
!=
nil
{
return
nil
,
entry
.
err
}
allInstances
=
append
(
allInstances
,
entry
.
instance
)
}
return
allInstances
,
nil
}
type
instanceOrError
struct
{
instance
*
gceInstance
err
error
}
// Gets the named instances, returning a map of each name to either the found instances or
// cloudprovider.InstanceNotFound if the instance is not found
func
(
g
*
Cloud
)
getInstanceOrErrorsByNames
(
allNames
[]
string
)
(
map
[
string
]
*
instanceOrError
,
error
)
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
defer
cancel
()
...
...
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