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
7a8ee6b6
Unverified
Commit
7a8ee6b6
authored
Jun 22, 2018
by
Olaf Klischat
Committed by
Davanum Srinivas
Jun 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUGFIX: must use ID, not name, of the node security group when adding rules to it
parent
1a1c0bab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
openstack_loadbalancer.go
...oudprovider/providers/openstack/openstack_loadbalancer.go
+16
-8
No files found.
pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go
View file @
7a8ee6b6
...
@@ -547,14 +547,14 @@ func getSubnetIDForLB(compute *gophercloud.ServiceClient, node v1.Node) (string,
...
@@ -547,14 +547,14 @@ func getSubnetIDForLB(compute *gophercloud.ServiceClient, node v1.Node) (string,
}
}
// getNodeSecurityGroupIDForLB lists node-security-groups for specific nodes
// getNodeSecurityGroupIDForLB lists node-security-groups for specific nodes
func
getNodeSecurityGroupIDForLB
(
compute
*
gophercloud
.
ServiceClient
,
nodes
[]
*
v1
.
Node
)
([]
string
,
error
)
{
func
getNodeSecurityGroupIDForLB
(
compute
*
gophercloud
.
ServiceClient
,
n
etwork
*
gophercloud
.
ServiceClient
,
n
odes
[]
*
v1
.
Node
)
([]
string
,
error
)
{
nodeSecurityGroupID
s
:=
sets
.
NewString
()
secGroupName
s
:=
sets
.
NewString
()
for
_
,
node
:=
range
nodes
{
for
_
,
node
:=
range
nodes
{
nodeName
:=
types
.
NodeName
(
node
.
Name
)
nodeName
:=
types
.
NodeName
(
node
.
Name
)
srv
,
err
:=
getServerByName
(
compute
,
nodeName
,
true
)
srv
,
err
:=
getServerByName
(
compute
,
nodeName
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nodeSecurityGroupIDs
.
List
()
,
err
return
[]
string
{}
,
err
}
}
// use the first node-security-groups
// use the first node-security-groups
...
@@ -562,11 +562,19 @@ func getNodeSecurityGroupIDForLB(compute *gophercloud.ServiceClient, nodes []*v1
...
@@ -562,11 +562,19 @@ func getNodeSecurityGroupIDForLB(compute *gophercloud.ServiceClient, nodes []*v1
// case 1: node1:SG1 node2:SG2 return SG1,SG2
// case 1: node1:SG1 node2:SG2 return SG1,SG2
// case 2: node1:SG1,SG2 node2:SG3,SG4 return SG1,SG3
// case 2: node1:SG1,SG2 node2:SG3,SG4 return SG1,SG3
// case 3: node1:SG1,SG2 node2:SG2,SG3 return SG1,SG2
// case 3: node1:SG1,SG2 node2:SG2,SG3 return SG1,SG2
securityGroupName
:=
srv
.
SecurityGroups
[
0
][
"name"
]
secGroupNames
.
Insert
(
srv
.
SecurityGroups
[
0
][
"name"
]
.
(
string
))
nodeSecurityGroupIDs
.
Insert
(
securityGroupName
.
(
string
))
}
}
return
nodeSecurityGroupIDs
.
List
(),
nil
secGroupIDs
:=
make
([]
string
,
secGroupNames
.
Len
())
for
i
,
name
:=
range
secGroupNames
.
List
()
{
secGroupID
,
err
:=
groups
.
IDFromName
(
network
,
name
)
if
err
!=
nil
{
return
[]
string
{},
err
}
secGroupIDs
[
i
]
=
secGroupID
}
return
secGroupIDs
,
nil
}
}
// isSecurityGroupNotFound return true while 'err' is object of gophercloud.ErrResourceNotFound
// isSecurityGroupNotFound return true while 'err' is object of gophercloud.ErrResourceNotFound
...
@@ -987,7 +995,7 @@ func (lbaas *LbaasV2) ensureSecurityGroup(clusterName string, apiService *v1.Ser
...
@@ -987,7 +995,7 @@ func (lbaas *LbaasV2) ensureSecurityGroup(clusterName string, apiService *v1.Ser
// find node-security-group for service
// find node-security-group for service
var
err
error
var
err
error
if
len
(
lbaas
.
opts
.
NodeSecurityGroupIDs
)
==
0
{
if
len
(
lbaas
.
opts
.
NodeSecurityGroupIDs
)
==
0
{
lbaas
.
opts
.
NodeSecurityGroupIDs
,
err
=
getNodeSecurityGroupIDForLB
(
lbaas
.
compute
,
nodes
)
lbaas
.
opts
.
NodeSecurityGroupIDs
,
err
=
getNodeSecurityGroupIDForLB
(
lbaas
.
compute
,
lbaas
.
network
,
nodes
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to find node-security-group for loadbalancer service %s/%s: %v"
,
apiService
.
Namespace
,
apiService
.
Name
,
err
)
return
fmt
.
Errorf
(
"failed to find node-security-group for loadbalancer service %s/%s: %v"
,
apiService
.
Namespace
,
apiService
.
Name
,
err
)
}
}
...
@@ -1299,7 +1307,7 @@ func (lbaas *LbaasV2) updateSecurityGroup(clusterName string, apiService *v1.Ser
...
@@ -1299,7 +1307,7 @@ func (lbaas *LbaasV2) updateSecurityGroup(clusterName string, apiService *v1.Ser
originalNodeSecurityGroupIDs
:=
lbaas
.
opts
.
NodeSecurityGroupIDs
originalNodeSecurityGroupIDs
:=
lbaas
.
opts
.
NodeSecurityGroupIDs
var
err
error
var
err
error
lbaas
.
opts
.
NodeSecurityGroupIDs
,
err
=
getNodeSecurityGroupIDForLB
(
lbaas
.
compute
,
nodes
)
lbaas
.
opts
.
NodeSecurityGroupIDs
,
err
=
getNodeSecurityGroupIDForLB
(
lbaas
.
compute
,
lbaas
.
network
,
nodes
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to find node-security-group for loadbalancer service %s/%s: %v"
,
apiService
.
Namespace
,
apiService
.
Name
,
err
)
return
fmt
.
Errorf
(
"failed to find node-security-group for loadbalancer service %s/%s: %v"
,
apiService
.
Namespace
,
apiService
.
Name
,
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