Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove config mismatched port during creation #2582

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

luolanzone
Copy link
Contributor

Signed-off-by: Lan Luo [email protected]

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #2582 (edebb33) into main (40685f9) will increase coverage by 23.24%.
The diff coverage is 84.61%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2582       +/-   ##
===========================================
+ Coverage   42.18%   65.43%   +23.24%     
===========================================
  Files         153      287      +134     
  Lines       18491    29653    +11162     
===========================================
+ Hits         7801    19402    +11601     
+ Misses       9991     8493     -1498     
- Partials      699     1758     +1059     
Flag Coverage Δ
e2e-tests 57.03% <50.00%> (?)
kind-e2e-tests 47.14% <0.00%> (?)
unit-tests 42.19% <83.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...gent/controller/noderoute/node_route_controller.go 63.69% <84.61%> (+16.44%) ⬆️
pkg/controller/egress/controller.go 51.29% <0.00%> (-35.91%) ⬇️
pkg/controller/networkpolicy/endpoint_querier.go 62.96% <0.00%> (-28.47%) ⬇️
pkg/agent/util/iptables/lock.go 60.00% <0.00%> (-21.82%) ⬇️
pkg/util/ip/ip.go 52.75% <0.00%> (-20.11%) ⬇️
pkg/controller/egress/ipallocator/allocator.go 64.46% <0.00%> (-18.52%) ⬇️
pkg/util/k8s/node.go 70.83% <0.00%> (-13.79%) ⬇️
.../registry/networkpolicy/clustergroupmember/rest.go 53.84% <0.00%> (-12.83%) ⬇️
...kg/agent/flowexporter/connections/conntrack_ovs.go 63.18% <0.00%> (-9.71%) ⬇️
pkg/agent/config/traffic_encap_mode.go 91.30% <0.00%> (-8.70%) ⬇️
... and 270 more

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, thanks

if interfaceConfig.OFPort != 0 {
return interfaceConfig.OFPort, nil
if err := c.ovsBridgeClient.DeletePort(interfaceConfig.PortUUID); err != nil {
return 0, fmt.Errorf("IPSec tunnel interface config doesn't match cached one, fail to delete stale IPSec tunnel port %s: %v", interfaceConfig.InterfaceName, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first sencence can be a separate log indicating a mismatch is detected and it's going to delete the stale port.

klog.InfoS("IPSec tunnel interface config doesn't match the cached one, deleting the stale IPSec tunnel port", "node", nodeName, "interface", interfaceConfig.InterfaceName)
if err := c.ovsBridgeClient.DeletePort(interfaceConfig.PortUUID); err != nil {
       return 0, fmt.Errorf("failed to delete stale IPSec tunnel port %s: %v", interfaceConfig.InterfaceName, err)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
} else {
}
if !ok || hasRemoved {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can rename ok to exists and set it to false after deleting the stale port, then only need to check exists here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@luolanzone
Copy link
Contributor Author

Hi @tnqn Could you help to take a look again? last time I addressed a comment but no review yet. thanks!

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnqn
Copy link
Member

tnqn commented Aug 27, 2021

/test-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants