diff --git a/pkg/proxy/service.go b/pkg/proxy/service.go index 2346565ed25..01ae6a69a6d 100644 --- a/pkg/proxy/service.go +++ b/pkg/proxy/service.go @@ -296,14 +296,15 @@ func NewServiceChangeTracker(makeServiceInfo makeServicePortFunc, ipFamily v1.IP // Delete item // - pass as the pair. func (sct *ServiceChangeTracker) Update(previous, current *v1.Service) bool { + // This is unexpected, we should return false directly. + if previous == nil && current == nil { + return false + } + svc := current if svc == nil { svc = previous } - // previous == nil && current == nil is unexpected, we should return false directly. - if svc == nil { - return false - } metrics.ServiceChangesTotal.Inc() namespacedName := types.NamespacedName{Namespace: svc.Namespace, Name: svc.Name}