mirror of https://github.com/k3s-io/k3s
Merge pull request #46258 from MrHohn/esipp-fix-needsUpdate
Automatic merge from submit-queue (batch tested with PRs 42042, 46139, 46126, 46258, 46312) Detect ExternalTrafficPolicy and HealthCheckNodePort changes in needsUpdate() Fix a bug that editing ExternalTrafficPolicy doesn't trigger LoadBalancer update. I'm surprise that ESIPP e2e tests didn't catch this. /assign @freehan @thockin **Release note**: ```release-note NONE ```pull/6/head
commit
447ee4a1c9
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue