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
3e52ea80
Commit
3e52ea80
authored
Apr 03, 2019
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename createLoadBalancerIfNeeded() to syncLoadBalancerIfNeeded() to reduce confusion
parent
66329fce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
service_controller.go
pkg/controller/service/service_controller.go
+3
-3
service_controller_test.go
pkg/controller/service/service_controller_test.go
+1
-1
No files found.
pkg/controller/service/service_controller.go
View file @
3e52ea80
...
...
@@ -248,7 +248,7 @@ func (s *ServiceController) processServiceUpdate(cachedService *cachedService, s
}
// cache the service, we need the info for service deletion
cachedService
.
state
=
service
err
:=
s
.
create
LoadBalancerIfNeeded
(
key
,
service
)
err
:=
s
.
sync
LoadBalancerIfNeeded
(
key
,
service
)
if
err
!=
nil
{
eventType
:=
"CreatingLoadBalancerFailed"
message
:=
"Error creating load balancer (will retry): "
...
...
@@ -269,10 +269,10 @@ func (s *ServiceController) processServiceUpdate(cachedService *cachedService, s
return
nil
}
//
create
LoadBalancerIfNeeded ensures that service's status is synced up with loadbalancer
//
sync
LoadBalancerIfNeeded ensures that service's status is synced up with loadbalancer
// i.e. creates loadbalancer for service if requested and deletes loadbalancer if the service
// doesn't want a loadbalancer no more. Returns whatever error occurred.
func
(
s
*
ServiceController
)
create
LoadBalancerIfNeeded
(
key
string
,
service
*
v1
.
Service
)
error
{
func
(
s
*
ServiceController
)
sync
LoadBalancerIfNeeded
(
key
string
,
service
*
v1
.
Service
)
error
{
// Note: It is safe to just call EnsureLoadBalancer. But, on some clouds that requires a delete & create,
// which may involve service interruption. Also, we would like user-friendly events.
...
...
pkg/controller/service/service_controller_test.go
View file @
3e52ea80
...
...
@@ -151,7 +151,7 @@ func TestCreateExternalLoadBalancer(t *testing.T) {
for
_
,
item
:=
range
table
{
controller
,
cloud
,
client
:=
newController
()
err
:=
controller
.
create
LoadBalancerIfNeeded
(
"foo/bar"
,
item
.
service
)
err
:=
controller
.
sync
LoadBalancerIfNeeded
(
"foo/bar"
,
item
.
service
)
if
!
item
.
expectErr
&&
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
else
if
item
.
expectErr
&&
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