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
ab713d74
Commit
ab713d74
authored
Aug 24, 2016
by
Angus Lees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cloudstack: Update LB API hosts->nodes
Update EnsureLoadBalancer/UpdateLoadBalancer API to use node objects.
parent
a718f78a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
cloudstack_loadbalancer.go
...dprovider/providers/cloudstack/cloudstack_loadbalancer.go
+9
-9
No files found.
pkg/cloudprovider/providers/cloudstack/cloudstack_loadbalancer.go
View file @
ab713d74
...
...
@@ -63,8 +63,8 @@ func (cs *CSCloud) GetLoadBalancer(clusterName string, service *v1.Service) (*v1
}
// EnsureLoadBalancer creates a new load balancer, or updates the existing one. Returns the status of the balancer.
func
(
cs
*
CSCloud
)
EnsureLoadBalancer
(
clusterName
string
,
service
*
v1
.
Service
,
hosts
[]
string
)
(
status
*
v1
.
LoadBalancerStatus
,
err
error
)
{
glog
.
V
(
4
)
.
Infof
(
"EnsureLoadBalancer(%v, %v, %v, %v, %v, %v)"
,
clusterName
,
service
.
Namespace
,
service
.
Name
,
service
.
Spec
.
LoadBalancerIP
,
service
.
Spec
.
Ports
,
host
s
)
func
(
cs
*
CSCloud
)
EnsureLoadBalancer
(
clusterName
string
,
service
*
v1
.
Service
,
nodes
[]
*
v1
.
Node
)
(
status
*
v1
.
LoadBalancerStatus
,
err
error
)
{
glog
.
V
(
4
)
.
Infof
(
"EnsureLoadBalancer(%v, %v, %v, %v, %v, %v)"
,
clusterName
,
service
.
Namespace
,
service
.
Name
,
service
.
Spec
.
LoadBalancerIP
,
service
.
Spec
.
Ports
,
node
s
)
if
len
(
service
.
Spec
.
Ports
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"requested load balancer with no ports"
)
...
...
@@ -87,7 +87,7 @@ func (cs *CSCloud) EnsureLoadBalancer(clusterName string, service *v1.Service, h
}
// Verify that all the hosts belong to the same network, and retrieve their ID's.
lb
.
hostIDs
,
lb
.
networkID
,
err
=
cs
.
verifyHosts
(
host
s
)
lb
.
hostIDs
,
lb
.
networkID
,
err
=
cs
.
verifyHosts
(
node
s
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -165,8 +165,8 @@ func (cs *CSCloud) EnsureLoadBalancer(clusterName string, service *v1.Service, h
}
// UpdateLoadBalancer updates hosts under the specified load balancer.
func
(
cs
*
CSCloud
)
UpdateLoadBalancer
(
clusterName
string
,
service
*
v1
.
Service
,
hosts
[]
string
)
error
{
glog
.
V
(
4
)
.
Infof
(
"UpdateLoadBalancer(%v, %v, %v, %v)"
,
clusterName
,
service
.
Namespace
,
service
.
Name
,
host
s
)
func
(
cs
*
CSCloud
)
UpdateLoadBalancer
(
clusterName
string
,
service
*
v1
.
Service
,
nodes
[]
*
v1
.
Node
)
error
{
glog
.
V
(
4
)
.
Infof
(
"UpdateLoadBalancer(%v, %v, %v, %v)"
,
clusterName
,
service
.
Namespace
,
service
.
Name
,
node
s
)
// Get the load balancer details and existing rules.
lb
,
err
:=
cs
.
getLoadBalancer
(
service
)
...
...
@@ -175,7 +175,7 @@ func (cs *CSCloud) UpdateLoadBalancer(clusterName string, service *v1.Service, h
}
// Verify that all the hosts belong to the same network, and retrieve their ID's.
lb
.
hostIDs
,
_
,
err
=
cs
.
verifyHosts
(
host
s
)
lb
.
hostIDs
,
_
,
err
=
cs
.
verifyHosts
(
node
s
)
if
err
!=
nil
{
return
err
}
...
...
@@ -276,10 +276,10 @@ func (cs *CSCloud) getLoadBalancer(service *v1.Service) (*loadBalancer, error) {
}
// verifyHosts verifies if all hosts belong to the same network, and returns the host ID's and network ID.
func
(
cs
*
CSCloud
)
verifyHosts
(
hosts
[]
string
)
([]
string
,
string
,
error
)
{
func
(
cs
*
CSCloud
)
verifyHosts
(
nodes
[]
*
v1
.
Node
)
([]
string
,
string
,
error
)
{
hostNames
:=
map
[
string
]
bool
{}
for
_
,
host
:=
range
host
s
{
hostNames
[
host
]
=
true
for
_
,
node
:=
range
node
s
{
hostNames
[
node
.
Name
]
=
true
}
p
:=
cs
.
client
.
VirtualMachine
.
NewListVirtualMachinesParams
()
...
...
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