mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 08:09:58 +00:00
Don't perform expensive go-cmp/cmp comparisons if unneeded
The cmp comparison is relatively expensive (#104821). If we're not going to log it, we shouldn't make the comparison.
This commit is contained in:
parent
34fb61beba
commit
668a546168
@ -198,8 +198,10 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v
|
||||
// Delete existing forwarding rule before making changes to the backend service. For example - changing protocol
|
||||
// of backend service without first deleting forwarding rule will throw an error since the linked forwarding
|
||||
// rule would show the old protocol.
|
||||
frDiff := cmp.Diff(existingFwdRule, newFwdRule)
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): forwarding rule changed - Existing - %+v\n, New - %+v\n, Diff(-existing, +new) - %s\n. Deleting existing forwarding rule.", loadBalancerName, existingFwdRule, newFwdRule, frDiff)
|
||||
if klog.V(2).Enabled() {
|
||||
frDiff := cmp.Diff(existingFwdRule, newFwdRule)
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): forwarding rule changed - Existing - %+v\n, New - %+v\n, Diff(-existing, +new) - %s\n. Deleting existing forwarding rule.", loadBalancerName, existingFwdRule, newFwdRule, frDiff)
|
||||
}
|
||||
if err = ignoreNotFound(g.DeleteRegionForwardingRule(loadBalancerName, g.region)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user