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
5f814d95
Commit
5f814d95
authored
May 22, 2017
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect ExternalTrafficPolicy and HealthCheckNodePort changes in needsUpdate()
parent
8e98f1df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
servicecontroller.go
pkg/controller/service/servicecontroller.go
+10
-0
servicecontroller_test.go
pkg/controller/service/servicecontroller_test.go
+18
-0
No files found.
pkg/controller/service/servicecontroller.go
View file @
5f814d95
...
...
@@ -474,6 +474,16 @@ func (s *ServiceController) needsUpdate(oldService *v1.Service, newService *v1.S
oldService
.
UID
,
newService
.
UID
)
return
true
}
if
oldService
.
Spec
.
ExternalTrafficPolicy
!=
newService
.
Spec
.
ExternalTrafficPolicy
{
s
.
eventRecorder
.
Eventf
(
newService
,
v1
.
EventTypeNormal
,
"ExternalTrafficPolicy"
,
"%v -> %v"
,
oldService
.
Spec
.
ExternalTrafficPolicy
,
newService
.
Spec
.
ExternalTrafficPolicy
)
return
true
}
if
oldService
.
Spec
.
HealthCheckNodePort
!=
newService
.
Spec
.
HealthCheckNodePort
{
s
.
eventRecorder
.
Eventf
(
newService
,
v1
.
EventTypeNormal
,
"HealthCheckNodePort"
,
"%v -> %v"
,
oldService
.
Spec
.
HealthCheckNodePort
,
newService
.
Spec
.
HealthCheckNodePort
)
return
true
}
return
false
}
...
...
pkg/controller/service/servicecontroller_test.go
View file @
5f814d95
...
...
@@ -673,6 +673,24 @@ func TestDoesExternalLoadBalancerNeedsUpdate(t *testing.T) {
},
expectedNeedsUpdate
:
true
,
},
{
testName
:
"If ExternalTrafficPolicy is different"
,
updateFn
:
func
()
{
oldSvc
=
defaultExternalService
()
newSvc
=
defaultExternalService
()
newSvc
.
Spec
.
ExternalTrafficPolicy
=
v1
.
ServiceExternalTrafficPolicyTypeLocal
},
expectedNeedsUpdate
:
true
,
},
{
testName
:
"If HealthCheckNodePort is different"
,
updateFn
:
func
()
{
oldSvc
=
defaultExternalService
()
newSvc
=
defaultExternalService
()
newSvc
.
Spec
.
HealthCheckNodePort
=
30123
},
expectedNeedsUpdate
:
true
,
},
}
controller
,
_
,
_
:=
newController
()
...
...
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