mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
Merge pull request #112208 from kerthcet/cleanup/code-optimization
kube-proxy: code optimization for readability
This commit is contained in:
commit
bcea98234f
@ -296,14 +296,15 @@ func NewServiceChangeTracker(makeServiceInfo makeServicePortFunc, ipFamily v1.IP
|
||||
// Delete item
|
||||
// - pass <service, nil> as the <previous, current> 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}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user