Skip to content

Commit

Permalink
fix: only log matched svc with np (#1287)
Browse files Browse the repository at this point in the history
When kube-ovn-controller starts in a cluster with lots of services, the previous empty match log will flood the screen:
```
I0208 00:31:03.804692       1 network_policy.go:789] match svc is []
I0208 00:31:03.804757       1 network_policy.go:789] match svc is []
I0208 00:31:03.804775       1 network_policy.go:789] match svc is []
I0208 00:31:03.804785       1 network_policy.go:789] match svc is []
I0208 00:31:03.804793       1 network_policy.go:789] match svc is []
I0208 00:31:03.804802       1 network_policy.go:789] match svc is []
I0208 00:31:03.804810       1 network_policy.go:789] match svc is []
I0208 00:31:03.804821       1 network_policy.go:789] match svc is []
I0208 00:31:03.804832       1 network_policy.go:789] match svc is []
```

(cherry picked from commit 432c407)
  • Loading branch information
oilbeater committed Feb 9, 2022
1 parent 6ef52c2 commit 5cf005e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,10 @@ func (c *Controller) svcMatchNetworkPolicies(svc *corev1.Service) ([]string, err
for _, np := range nps {
if isPodMatchNetworkPolicy(pod, *podNs, np, np.Namespace) {
match = append(match, fmt.Sprintf("%s/%s", np.Namespace, np.Name))
klog.V(3).Infof("svc %s/%s match np %s/%s", svc.Namespace, svc.Name, np.Namespace, np.Name)
}
}
}
klog.Infof("match svc is %v", match)
return match, nil
}

Expand Down

0 comments on commit 5cf005e

Please sign in to comment.