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

Delete secondaryNetwork OVS ports correctly after an Agent restart #6853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KMAnju-2021
Copy link
Contributor

@KMAnju-2021 KMAnju-2021 commented Dec 11, 2024

Closes: #6578 #5623

Store the SecondaryNetwork interface in interfacestore after Agent restart and delete secondaryNetwork OVS ports correctly.

@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 2 times, most recently from 63e028a to 3b7abe8 Compare December 11, 2024 19:15
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.

new tests are needed under test/e2e-secondary-network to validate this patch

cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/cniserver/pod_configuration.go Outdated Show resolved Hide resolved
pkg/agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 6 times, most recently from 3bf9b47 to 63d1231 Compare December 17, 2024 11:50
@rajnkamr rajnkamr added this to the Antrea v2.3 release milestone Dec 26, 2024
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 3 times, most recently from 7904bea to 20ca6f4 Compare January 3, 2025 10:33
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 3 times, most recently from 5e2b8e1 to 5e22752 Compare January 5, 2025 20:16
@luolanzone
Copy link
Contributor

@KMAnju-2021 I didn't see any new tests for the patch, re-post Antonin's comment:

new tests are needed under test/e2e-secondary-network to validate this patch

@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch from 5e22752 to dd90f3c Compare January 16, 2025 10:26
pkg/agent/secondarynetwork/init.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
pkg/agent/secondarynetwork/podwatch/controller.go Outdated Show resolved Hide resolved
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch from dd90f3c to e61f080 Compare January 20, 2025 11:35
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 3 times, most recently from 0e16916 to ecf56ad Compare February 6, 2025 12:07
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 11 times, most recently from 906ebd1 to 07010b8 Compare February 10, 2025 11:37
@KMAnju-2021 KMAnju-2021 requested a review from jianjuns February 10, 2025 18:04
@@ -219,6 +219,124 @@ func (data *testData) pingBetweenInterfaces(t *testing.T) error {
return nil
}

// GetOVSPorts returns a list of OVS ports for a given pod.
func (data *testData) GetOVSPorts(targetPod *testPodInfo) ([]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All these funcs need not to be public?

beforeRestartOVSPorts = append(beforeRestartOVSPorts, ports...)
}

if err := e2eTestData.RestartAntreaAgentPods(90 * time.Second); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant could we remove some Pods after Agent stops, and then check the secondary OVS ports are removed after Agent restarts.

return nil
}

// RemovePodsAndCheckOVSPorts verifies that OVS ports are removed when pods are deleted.
Copy link
Contributor

Choose a reason for hiding this comment

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

pods -> Pods

Please change other occurrences too.

}

// Verify that the deleted pod's IPs are released
podIPs, err := data.listPodIPs(pod)
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant check secondary interface IPs are released to Antrea IPPool, for removed Pods when Agent stopped.
I am fine not to include it to the test case, if it is complex to implement (probably not that hard to get the state from IPPool CR).

@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch from 07010b8 to 4757476 Compare February 13, 2025 05:27

// CheckIPReleased verifies if the VLAN IP from the deleted pod is released.
func (data *testData) checkIPReleased(vlanIP string) error {
ipPoolCmd := []string{"kubectl", "get", "ippool", "-o", "jsonpath={.status.allocatedIPs}"}
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel it is simpler/better to check the IPPool CR status directly via API. You can check example code in antreaipam_test.go. Sorry, I thought about sending you the pointer earlier but forgot it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure , refactoring the code, thanks!

@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch 9 times, most recently from 63f27ab to 10b33f7 Compare February 13, 2025 19:45
Signed-off-by: KMAnju-2021 <km074btcse18@igdtuw.ac.in>
@KMAnju-2021 KMAnju-2021 force-pushed the secondary-network-port branch from 10b33f7 to 795304f Compare February 13, 2025 20:12
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.

SecondaryNetwork OVS ports cannot be deleted correctly after an Agent restart
6 participants