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
2a5a1215
Commit
2a5a1215
authored
Oct 09, 2015
by
Alex Robinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix small comments.
parent
429fa7a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
gce.go
pkg/cloudprovider/providers/gce/gce.go
+10
-8
No files found.
pkg/cloudprovider/providers/gce/gce.go
View file @
2a5a1215
...
...
@@ -400,8 +400,9 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.
return
nil
,
fmt
.
Errorf
(
"failed to delete existing forwarding rule %s for load balancer update: %v"
,
name
,
err
)
}
if
deleteFwdRuleIP
{
// Delete the old IP to avoid leaking it, since we're going to be using
// the user-requested IP when recreating the forwarding rule below.
// Delete the old forwarding rule's IP to avoid leaking it, since we're
// going to be using the user-requested IP when recreating the forwarding
// rule below.
gce
.
deleteStaticIP
(
name
,
region
)
}
}
...
...
@@ -429,6 +430,10 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.
return
status
,
nil
}
// Passing nil for requested IP is perfectly fine - it just means that no specific
// IP is being requested.
// Returns whether the forwarding rule exists, whether it needs to be updated,
// what its IP address is (if it exists), and any error we encountered.
func
(
gce
*
GCECloud
)
forwardingRuleNeedsUpdate
(
name
,
region
string
,
requestedIP
net
.
IP
,
ports
[]
*
api
.
ServicePort
)
(
exists
bool
,
needsUpdate
bool
,
ipAddress
string
,
err
error
)
{
fwd
,
err
:=
gce
.
service
.
ForwardingRules
.
Get
(
gce
.
projectID
,
region
,
name
)
.
Do
()
if
err
!=
nil
{
...
...
@@ -507,13 +512,10 @@ func (gce *GCECloud) firewallNeedsUpdate(name, region, ipAddress string, ports [
if
fw
.
Description
!=
makeFirewallDescription
(
ipAddress
)
{
return
true
,
true
,
nil
}
// Make sure the allowed ports match
if
len
(
fw
.
Allowed
)
!=
1
{
return
true
,
true
,
nil
}
if
fw
.
Allowed
[
0
]
.
IPProtocol
!=
"tcp"
{
if
len
(
fw
.
Allowed
)
!=
1
||
fw
.
Allowed
[
0
]
.
IPProtocol
!=
"tcp"
{
return
true
,
true
,
nil
}
// Make sure the allowed ports match.
allowedPorts
:=
make
([]
string
,
len
(
ports
))
for
ix
:=
range
ports
{
allowedPorts
[
ix
]
=
strconv
.
Itoa
(
ports
[
ix
]
.
Port
)
...
...
@@ -624,7 +626,7 @@ func (gce *GCECloud) updateFirewall(name, region, ipAddress string, ports []*api
}
if
op
!=
nil
{
err
=
gce
.
waitForGlobalOp
(
op
)
if
err
!=
nil
&&
!
isHTTPErrorCode
(
err
,
http
.
StatusConflict
)
{
if
err
!=
nil
{
return
err
}
}
...
...
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