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
7b5f3a1d
Commit
7b5f3a1d
authored
May 24, 2018
by
Daniel Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that only IPs are used as node addresses in OpenStack LBs
parent
481b2dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
openstack_loadbalancer.go
...oudprovider/providers/openstack/openstack_loadbalancer.go
+12
-6
No files found.
pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go
View file @
7b5f3a1d
...
...
@@ -487,21 +487,27 @@ func (lbaas *LbaasV2) GetLoadBalancer(ctx context.Context, clusterName string, s
// The LB needs to be configured with instance addresses on the same
// subnet as the LB (aka opts.SubnetID). Currently we're just
// guessing that the node's InternalIP is the right address - and that
// should be sufficient for all "normal" cases.
// guessing that the node's InternalIP is the right address.
// In case no InternalIP can be found, ExternalIP is tried.
// If neither InternalIP nor ExternalIP can be found an error is
// returned.
func
nodeAddressForLB
(
node
*
v1
.
Node
)
(
string
,
error
)
{
addrs
:=
node
.
Status
.
Addresses
if
len
(
addrs
)
==
0
{
return
""
,
ErrNoAddressFound
}
for
_
,
addr
:=
range
addrs
{
if
addr
.
Type
==
v1
.
NodeInternalIP
{
return
addr
.
Address
,
nil
allowedAddrTypes
:=
[]
v1
.
NodeAddressType
{
v1
.
NodeInternalIP
,
v1
.
NodeExternalIP
}
for
_
,
allowedAddrType
:=
range
allowedAddrTypes
{
for
_
,
addr
:=
range
addrs
{
if
addr
.
Type
==
allowedAddrType
{
return
addr
.
Address
,
nil
}
}
}
return
addrs
[
0
]
.
Address
,
nil
return
""
,
ErrNoAddressFound
}
//getStringFromServiceAnnotation searches a given v1.Service for a specific annotationKey and either returns the annotation's value or a specified defaultSetting
...
...
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