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

Restore NO_FLOOD to OVS ports after reconnecting the OVS bridge #4654

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

xliuxu
Copy link
Contributor

@xliuxu xliuxu commented Feb 22, 2023

The NO_FLOOD configuration is lost when the OVS daemon is restarted. Currently, the only way to recover this configuration is by restarting the agent. This pull request adds logic to recover the configuration when receiving OVS reconnection events.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #4654 (caea932) into main (d5dd02e) will decrease coverage by 0.30%.
The diff coverage is 57.50%.

❗ Current head caea932 differs from pull request most recent head 35afabf. Consider uploading reports for the commit 35afabf to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4654      +/-   ##
==========================================
- Coverage   69.86%   69.57%   -0.30%     
==========================================
  Files         403      402       -1     
  Lines       59778    58421    -1357     
==========================================
- Hits        41765    40644    -1121     
+ Misses      15189    14975     -214     
+ Partials     2824     2802      -22     
Flag Coverage Δ *Carryforward flag
e2e-tests 38.31% <57.50%> (-0.02%) ⬇️
integration-tests 34.46% <ø> (+0.01%) ⬆️ Carriedforward from e909b97
kind-e2e-tests 47.15% <ø> (+0.22%) ⬆️ Carriedforward from e909b97
unit-tests 59.79% <ø> (-0.13%) ⬇️ Carriedforward from e909b97

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/interfacestore/types.go 100.00% <ø> (ø)
...gent/controller/noderoute/node_route_controller.go 62.36% <57.14%> (-6.23%) ⬇️
pkg/agent/agent.go 56.00% <57.57%> (-0.66%) ⬇️
pkg/agent/util/ethtool/ethtool_linux.go 0.00% <0.00%> (-70.00%) ⬇️
...nt/apiserver/handlers/serviceexternalip/handler.go 29.62% <0.00%> (-22.23%) ⬇️
pkg/agent/proxy/topology.go 72.72% <0.00%> (-9.10%) ⬇️
pkg/agent/controller/egress/egress_controller.go 75.27% <0.00%> (-8.38%) ⬇️
pkg/agent/controller/networkpolicy/packetin.go 70.27% <0.00%> (-6.76%) ⬇️
pkg/agent/wireguard/client_linux.go 77.07% <0.00%> (-4.46%) ⬇️
... and 38 more

@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch from d35922c to 23f835a Compare February 22, 2023 12:06
@xliuxu
Copy link
Contributor Author

xliuxu commented Feb 22, 2023

/test-all

@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch from 23f835a to 383a006 Compare February 22, 2023 12:08
@xliuxu xliuxu added the action/backport Indicates a PR that requires backports. label Feb 22, 2023
Comment on lines 394 to 391
} else {
klog.InfoS("Set port no-flood success", "PortName", port.Name)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else {
klog.InfoS("Set port no-flood success", "PortName", port.Name)
}
}
klog.InfoS("Set port no-flood successfully", "PortName", port.Name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

Comment on lines 598 to 599
klog.Info("Restoring OF port configs to OVS bridge")
err := i.restorePortConfigs()
if err != nil {
klog.ErrorS(err, "Failed to restore OF port configs")
} else {
klog.Info("Restore OF port configs completed")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
klog.Info("Restoring OF port configs to OVS bridge")
err := i.restorePortConfigs()
if err != nil {
klog.ErrorS(err, "Failed to restore OF port configs")
} else {
klog.Info("Restore OF port configs completed")
}
klog.InfoS("Restoring OF port configs to OVS bridge")
if err := i.restorePortConfigs(); err != nil {
klog.ErrorS(err, "Failed to restore OF port configs")
} else {
klog.InfoS("Port configs restoration completed")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

@@ -655,7 +655,6 @@ func getPodCIDRsOnNode(node *corev1.Node) []string {
func (c *Controller) createIPSecTunnelPort(nodeName string, nodeIP net.IP) (int32, error) {
portName := util.GenerateNodeTunnelInterfaceName(nodeName)
interfaceConfig, exists := c.interfaceStore.GetNodeTunnelInterface(nodeName)

Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this.

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. Thanks!

@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch 2 times, most recently from 6a528dc to 8f29ecb Compare February 24, 2023 12:01
Comment on lines 378 to 383
ovsCtlClient := ovsctl.NewClient(i.ovsBridge)
ovsPorts, err := i.ovsBridgeClient.GetPortList()
if err != nil {
return fmt.Errorf("failed to list OVS ports: %w", err)
}
for _, port := range ovsPorts {
Copy link
Member

Choose a reason for hiding this comment

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

don't we already cache all TrafficControl and IPSec interfaces? I think they can be fetched via GetInterfacesByType more efficiently?

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. Thanks for the suggestion!

@@ -714,6 +717,10 @@ func (c *Controller) createIPSecTunnelPort(nodeName string, nodeIP net.IP) (int3
// Let NodeRouteController retry at errors.
return 0, fmt.Errorf("failed to get of_port of IPsec tunnel port for Node %s", nodeName)
}
// Set external_ids to the port for upgrade case.
if err := c.ovsBridgeClient.SetPortExternalIDs(portName, ovsExternalIDs); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

initInterfaceStore has a logic to fill missed AntreaInterfaceTypeKey, I think this could be moved there to unify the logic.

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. Thanks!

@@ -43,6 +43,7 @@ const (
AntreaUplink = "uplink"
AntreaHost = "host"
AntreaTrafficControl = "traffic-control"
AntreaIPsec = "ipsec"
Copy link
Member

Choose a reason for hiding this comment

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

perhaps ipsec-tunnel to be more specific.

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.

@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch 2 times, most recently from d2472a2 to 35afabf Compare February 27, 2023 13:59
@xliuxu
Copy link
Contributor Author

xliuxu commented Feb 28, 2023

/test-all

@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch from 35afabf to 161f575 Compare February 28, 2023 03:05
The NO_FLOOD configuration is lost when the OVS daemon is restarted.
Currently, the only way to recover this configuration is by restarting
the agent. This pull request adds logic to recover the configuration
when receiving OVS reconnection events.

Signed-off-by: Xu Liu <[email protected]>
@xliuxu xliuxu force-pushed the fix_no_flood_bridge_reconnect branch from 161f575 to fe02848 Compare February 28, 2023 03:54
@xliuxu
Copy link
Contributor Author

xliuxu commented Feb 28, 2023

/test-e2e

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 tnqn added the action/release-note Indicates a PR that should be included in release notes. label Mar 1, 2023
@tnqn
Copy link
Member

tnqn commented Mar 1, 2023

/skip-e2e
/test-conformance
/test-networkpolicy

@tnqn
Copy link
Member

tnqn commented Mar 1, 2023

/skip-conformance its failure is because the tested svc IP which was supposed to be unreachable happened to be a real server IP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/backport Indicates a PR that requires backports. action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants