Fixed a bug that mistake use newObj as oldObj in endpoint slice update

This commit is contained in:
fatkun
2020-06-21 15:09:24 +08:00
parent c6011f2d54
commit eb9bca5f06
3 changed files with 36 additions and 1 deletions

View File

@@ -404,7 +404,7 @@ func (c *Controller) onEndpointSliceAdd(obj interface{}) {
// endpointSliceTracker or the managed-by value of the EndpointSlice has changed
// from or to this controller.
func (c *Controller) onEndpointSliceUpdate(prevObj, obj interface{}) {
prevEndpointSlice := obj.(*discovery.EndpointSlice)
prevEndpointSlice := prevObj.(*discovery.EndpointSlice)
endpointSlice := obj.(*discovery.EndpointSlice)
if endpointSlice == nil || prevEndpointSlice == nil {
utilruntime.HandleError(fmt.Errorf("Invalid EndpointSlice provided to onEndpointSliceUpdate()"))