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
9be85fba
Commit
9be85fba
authored
Apr 08, 2016
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23541 from bprashanth/fw_default
Default firewall port to TCP when unspecified.
parents
ca5b7642
7436fc62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
gce.go
pkg/cloudprovider/providers/gce/gce.go
+17
-2
No files found.
pkg/cloudprovider/providers/gce/gce.go
View file @
9be85fba
...
@@ -924,6 +924,11 @@ func (gce *GCECloud) firewallObject(name, region, desc string, sourceRanges nets
...
@@ -924,6 +924,11 @@ func (gce *GCECloud) firewallObject(name, region, desc string, sourceRanges nets
TargetTags
:
hostTags
,
TargetTags
:
hostTags
,
Allowed
:
[]
*
compute
.
FirewallAllowed
{
Allowed
:
[]
*
compute
.
FirewallAllowed
{
{
{
// TODO: Make this more generic. Currently this method is only
// used to create firewall rules for loadbalancers, which have
// exactly one protocol, so we can never end up with a list of
// mixed TCP and UDP ports. It should be possible to use a
// single firewall rule for both a TCP and UDP lb.
IPProtocol
:
strings
.
ToLower
(
string
(
ports
[
0
]
.
Protocol
)),
IPProtocol
:
strings
.
ToLower
(
string
(
ports
[
0
]
.
Protocol
)),
Ports
:
allowedPorts
,
Ports
:
allowedPorts
,
},
},
...
@@ -1237,8 +1242,13 @@ func (gce *GCECloud) CreateFirewall(name, desc string, sourceRanges netsets.IPNe
...
@@ -1237,8 +1242,13 @@ func (gce *GCECloud) CreateFirewall(name, desc string, sourceRanges netsets.IPNe
// TODO: This completely breaks modularity in the cloudprovider but the methods
// TODO: This completely breaks modularity in the cloudprovider but the methods
// shared with the TCPLoadBalancer take api.ServicePorts.
// shared with the TCPLoadBalancer take api.ServicePorts.
svcPorts
:=
[]
api
.
ServicePort
{}
svcPorts
:=
[]
api
.
ServicePort
{}
// TODO: Currently the only consumer of this method is the GCE L7
// loadbalancer controller, which never needs a protocol other than TCP.
// We should pipe through a mapping of port:protocol and default to TCP
// if UDP ports are required. This means the method signature will change
// forcing downstream clients to refactor interfaces.
for
_
,
p
:=
range
ports
{
for
_
,
p
:=
range
ports
{
svcPorts
=
append
(
svcPorts
,
api
.
ServicePort
{
Port
:
int
(
p
)})
svcPorts
=
append
(
svcPorts
,
api
.
ServicePort
{
Port
:
int
(
p
)
,
Protocol
:
api
.
ProtocolTCP
})
}
}
hosts
,
err
:=
gce
.
getInstancesByNames
(
hostNames
)
hosts
,
err
:=
gce
.
getInstancesByNames
(
hostNames
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -1266,8 +1276,13 @@ func (gce *GCECloud) UpdateFirewall(name, desc string, sourceRanges netsets.IPNe
...
@@ -1266,8 +1276,13 @@ func (gce *GCECloud) UpdateFirewall(name, desc string, sourceRanges netsets.IPNe
// TODO: This completely breaks modularity in the cloudprovider but the methods
// TODO: This completely breaks modularity in the cloudprovider but the methods
// shared with the TCPLoadBalancer take api.ServicePorts.
// shared with the TCPLoadBalancer take api.ServicePorts.
svcPorts
:=
[]
api
.
ServicePort
{}
svcPorts
:=
[]
api
.
ServicePort
{}
// TODO: Currently the only consumer of this method is the GCE L7
// loadbalancer controller, which never needs a protocol other than TCP.
// We should pipe through a mapping of port:protocol and default to TCP
// if UDP ports are required. This means the method signature will change,
// forcing downstream clients to refactor interfaces.
for
_
,
p
:=
range
ports
{
for
_
,
p
:=
range
ports
{
svcPorts
=
append
(
svcPorts
,
api
.
ServicePort
{
Port
:
int
(
p
)})
svcPorts
=
append
(
svcPorts
,
api
.
ServicePort
{
Port
:
int
(
p
)
,
Protocol
:
api
.
ProtocolTCP
})
}
}
hosts
,
err
:=
gce
.
getInstancesByNames
(
hostNames
)
hosts
,
err
:=
gce
.
getInstancesByNames
(
hostNames
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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