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
967fac0a
Commit
967fac0a
authored
Sep 22, 2015
by
Kenneth Shelton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to use sets utility
parent
10f79eb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
gce.go
pkg/cloudprovider/providers/gce/gce.go
+4
-12
No files found.
pkg/cloudprovider/providers/gce/gce.go
View file @
967fac0a
...
...
@@ -471,9 +471,7 @@ func (gce *GCECloud) computeHostTags(hosts []string) ([]string, error) {
return
nil
,
err
}
// Set symantics
// * This will be faster for large numbers of hosts (over iterating for "contains")
set
:=
make
(
map
[
string
]
bool
)
tags
:=
sets
.
NewString
()
for
_
,
instance
:=
range
res
.
Items
{
longest_tag
:=
""
for
_
,
tag
:=
range
instance
.
Tags
.
Items
{
...
...
@@ -482,23 +480,17 @@ func (gce *GCECloud) computeHostTags(hosts []string) ([]string, error) {
}
}
if
len
(
longest_tag
)
>
0
{
set
[
longest_tag
]
=
true
}
else
if
len
(
set
)
>
0
{
tags
.
Insert
(
longest_tag
)
}
else
if
len
(
tags
)
>
0
{
return
nil
,
fmt
.
Errorf
(
"Some, but not all, instances have prefix tags (%s is missing)"
,
instance
.
Name
)
}
}
// Get the values
tags
:=
make
([]
string
,
0
,
len
(
set
))
for
tag
:=
range
set
{
tags
=
append
(
tags
,
tag
)
}
if
len
(
tags
)
==
0
{
glog
.
V
(
2
)
.
Info
(
"No instances had tags, creating rule without target tags"
)
}
return
tags
,
nil
return
tags
.
List
()
,
nil
}
// UpdateTCPLoadBalancer is an implementation of TCPLoadBalancer.UpdateTCPLoadBalancer.
...
...
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