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

Fix possible Antrea Agent crash in dualstack mode #4480

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

hongliangl
Copy link
Contributor

When a Cluster is dualstack, it assumes that every Node is configured with both IPv4 and IPv6 addresses for Antrea Agent. However, if a Node is only configured with either IPv4 or IPv6 address, Antrea Agent will get crashed.

Signed-off-by: Hongliang Liu lhongliang@vmware.com

@hongliangl hongliangl added action/backport Indicates a PR that requires backports. area/component/agent Issues or PRs related to the agent component labels Dec 14, 2022
@@ -75,15 +75,19 @@ func newFeaturePodConnectivity(
if ipProtocol == binding.ProtocolIP {
ctZones[ipProtocol] = CtZone
gatewayIPs[ipProtocol] = nodeConfig.GatewayConfig.IPv4
nodeIPs[ipProtocol] = nodeConfig.NodeIPv4Addr.IP
if nodeConfig.NodeIPv4Addr != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have this case?

@codecov
Copy link

codecov bot commented Dec 14, 2022

Codecov Report

Merging #4480 (9cf5b0f) into main (bd0d275) will increase coverage by 3.84%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4480      +/-   ##
==========================================
+ Coverage   64.58%   68.42%   +3.84%     
==========================================
  Files         390      400      +10     
  Lines       57640    58306     +666     
==========================================
+ Hits        37225    39897    +2672     
+ Misses      17760    15633    -2127     
- Partials     2655     2776     +121     
Flag Coverage Δ
e2e-tests 38.21% <32.14%> (-0.13%) ⬇️
integration-tests 34.61% <0.00%> (+0.03%) ⬆️
kind-e2e-tests 48.03% <32.14%> (+1.55%) ⬆️
unit-tests 57.44% <64.28%> (+1.76%) ⬆️
Impacted Files Coverage Δ
pkg/agent/agent.go 56.74% <25.00%> (-0.38%) ⬇️
pkg/agent/config/node_config.go 94.87% <95.00%> (-1.13%) ⬇️
pkg/agent/openflow/meters_linux.go 66.66% <0.00%> (-5.56%) ⬇️
.../flowexporter/connections/conntrack_connections.go 78.57% <0.00%> (-5.24%) ⬇️
pkg/controller/networkpolicy/store/addressgroup.go 88.37% <0.00%> (-3.49%) ⬇️
pkg/agent/controller/networkpolicy/reject.go 73.55% <0.00%> (-2.89%) ⬇️
pkg/agent/controller/networkpolicy/packetin.go 70.27% <0.00%> (-2.71%) ⬇️
pkg/agent/flowexporter/exporter/exporter.go 69.11% <0.00%> (-2.42%) ⬇️
...g/agent/controller/serviceexternalip/controller.go 79.18% <0.00%> (-2.39%) ⬇️
pkg/config/flowaggregator/default.go 97.82% <0.00%> (-2.18%) ⬇️
... and 77 more

pkg/agent/config/node_config.go Outdated Show resolved Hide resolved
pkg/agent/config/node_config.go Outdated Show resolved Hide resolved
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ipv4Enabled, err := IsIPv4Enabled(tt.nodeConfig, tt.trafficEncapMode)
assert.Equal(t, tt.expectedErr, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

use assert.EqualError, or assert.ErrorContains

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

@antoninbas antoninbas added this to the Antrea v1.11 release milestone Jan 14, 2023
When a Cluster is dualstack, it assumes that every Node is configured with
both IPv4 and IPv6 addresses for Antrea Agent. However, if a Node is only
configured with either IPv4 or IPv6 address, Antrea Agent will get crashed.

Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM

@hongliangl
Copy link
Contributor Author

/test-all

@antoninbas antoninbas changed the title Fix that Antrea Agent may crash when dualstack Fix possible Antrea Agent crash in dualstack mode Jan 18, 2023
@antoninbas
Copy link
Contributor

/test-ipv6-all

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 Feb 7, 2023

/test-ipv6-e2e

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. area/component/agent Issues or PRs related to the agent component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants