mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Detect ExternalTrafficPolicy and HealthCheckNodePort changes in needsUpdate()
This commit is contained in:
parent
8e98f1dfec
commit
5f814d957e
@ -474,6 +474,16 @@ func (s *ServiceController) needsUpdate(oldService *v1.Service, newService *v1.S
|
|||||||
oldService.UID, newService.UID)
|
oldService.UID, newService.UID)
|
||||||
return true
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
@ -673,6 +673,24 @@ func TestDoesExternalLoadBalancerNeedsUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedNeedsUpdate: true,
|
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()
|
controller, _, _ := newController()
|
||||||
|
Loading…
Reference in New Issue
Block a user