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 deletion of tunnel map entries when node has non-zero cluster ID. #27353

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/datapath/linux/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,8 @@ func (n *linuxNodeHandler) nodeDelete(oldNode *nodeTypes.Node) error {
}

if n.nodeConfig.EnableEncapsulation {
oldPrefix4 := cmtypes.PrefixClusterFromCIDR(oldNode.IPv4AllocCIDR, oldNode.ClusterID)
oldPrefix6 := cmtypes.PrefixClusterFromCIDR(oldNode.IPv6AllocCIDR, oldNode.ClusterID)
oldPrefix4 := cmtypes.PrefixClusterFromCIDR(oldNode.IPv4AllocCIDR, 0)
oldPrefix6 := cmtypes.PrefixClusterFromCIDR(oldNode.IPv6AllocCIDR, 0)
if err := deleteTunnelMapping(oldPrefix4, false); err != nil {
errs = errors.Join(errs, fmt.Errorf("failed to remove old encapsulation config: deleting tunnel mapping for ipv4: %w", err))
}
Expand Down
15 changes: 10 additions & 5 deletions pkg/datapath/linux/node_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ func (s *linuxPrivilegedBaseTestSuite) TestNodeUpdateEncapsulation(c *check.C) {

// nodev1: ip4Alloc1, ip6alloc1 => externalNodeIP1
nodev1 := nodeTypes.Node{
Name: "node1",
Name: "node1",
ClusterID: 11,
IPAddresses: []nodeTypes.Address{
{IP: externalNodeIP1, Type: nodeaddressing.NodeInternalIP},
},
Expand Down Expand Up @@ -443,7 +444,8 @@ func (s *linuxPrivilegedBaseTestSuite) TestNodeUpdateEncapsulation(c *check.C) {

// nodev2: ip4Alloc1, ip6alloc1 => externalNodeIP2
nodev2 := nodeTypes.Node{
Name: "node1",
Name: "node1",
ClusterID: 11,
IPAddresses: []nodeTypes.Address{
{IP: externalNodeIP2, Type: nodeaddressing.NodeInternalIP},
},
Expand Down Expand Up @@ -482,7 +484,8 @@ func (s *linuxPrivilegedBaseTestSuite) TestNodeUpdateEncapsulation(c *check.C) {

// nodev3: ip4Alloc2, ip6alloc2 => externalNodeIP1
nodev3 := nodeTypes.Node{
Name: "node1",
Name: "node1",
ClusterID: 11,
IPAddresses: []nodeTypes.Address{
{IP: externalNodeIP1, Type: nodeaddressing.NodeInternalIP},
},
Expand Down Expand Up @@ -541,7 +544,8 @@ func (s *linuxPrivilegedBaseTestSuite) TestNodeUpdateEncapsulation(c *check.C) {

// nodev4: stop announcing CIDRs
nodev4 := nodeTypes.Node{
Name: "node1",
Name: "node1",
ClusterID: 11,
IPAddresses: []nodeTypes.Address{
{IP: externalNodeIP1, Type: nodeaddressing.NodeInternalIP},
},
Expand Down Expand Up @@ -572,7 +576,8 @@ func (s *linuxPrivilegedBaseTestSuite) TestNodeUpdateEncapsulation(c *check.C) {

// nodev5: re-announce CIDRs
nodev5 := nodeTypes.Node{
Name: "node1",
Name: "node1",
ClusterID: 11,
IPAddresses: []nodeTypes.Address{
{IP: externalNodeIP1, Type: nodeaddressing.NodeInternalIP},
},
Expand Down