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

e2e: Optimize and add e2e use cases for 'ip rule' #2823

Merged
merged 1 commit into from
Dec 15, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/doc/coordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
| C00002 | coordinator in tuneMode: overlay works well | p1 | smoke | done | |
| C00003 | coordinator in tuneMode: underlay with two NIC | p1 | smoke | | |
| C00004 | coordinator in tuneMode: overlay with two NIC | p1 | smoke | | |
| C00005 | In overlay mode: specify the NIC (eth0) where the default route is located, use 'ip r get 8.8.8.8' to see if default route nic is the specify NIC | p2 | | done | |
| C00006 | In underlay mode: specify the NIC (eth0) where the default route is located, use 'ip r get 8.8.8.8' to see if default route nic is the specify NIC | p2 | | | |
| C00005 | In overlay mode: specify the NIC (net1) where the default route is located, use 'ip r get 8.8.8.8' to see if default route nic is the specify NIC | p2 | | done | |
| C00006 | In underlay mode: specify the NIC (net1) where the default route is located, use 'ip r get 8.8.8.8' to see if default route nic is the specify NIC | p2 | | done | |
| C00007 | ip conflict detection (ipv4, ipv6) | p2 | | done | |
| C00008 | override pod mac prefix | p2 | | done | |
| C00009 | gateway connection detection | p2 | | done | |
| C00010 | auto clean up the dirty rules(routing\neighborhood) while pod starting | p2 | | |
| C00011 | In the default scenario (Do not specify the NIC where the default route is located in any way) , use 'ip r get 8.8.8.8' to see if default route NIC is `net1` | p2 | | done | |
| C00012 | In multi-nic case , use 'ip r get <service_subnet> and <hostIP>' to see if src is from pod's eth0, note: only for ipv4. | p2 | | | |
| C00011 | In the default scenario (Do not specify the NIC where the default route is located in any way) , use 'ip r get 8.8.8.8' to see if default route NIC is `eth0` | p2 | | done | |
| C00012 | In multi-nic case , use 'ip r get <service_subnet> and <hostIP>' to see if src is from pod's eth0, note: only for ipv4. | p2 | | done | |
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
},
CoordinatorConfig: &spiderpoolv2beta1.CoordinatorSpec{
PodMACPrefix: &macPrefix,
PodDefaultRouteNIC: &common.NIC1,
PodDefaultRouteNIC: &common.NIC2,
Mode: &mode,
PodCIDRType: &podCidrType,
},
Expand Down Expand Up @@ -286,14 +286,14 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
ctx, cancel = context.WithTimeout(context.Background(), common.ExecCommandTimeout)
defer cancel()

// In this use case, the default routing NIC is specified as eth0 through `CoordinatorSpec.PodDefaultRouteNIC`
// ip r get <address outside the cluster>, should flow out from the correct NIC(eth0).
// In this use case, the default routing NIC is specified as net1 (originally the default is eth0) through `CoordinatorSpec.PodDefaultRouteNIC`
// ip r get <address outside the cluster>, should flow out from the correct NIC(net1).
GinkgoWriter.Println("ip -4 r get <address outside the cluster>")
runGetIPString := "ip -4 r get '8.8.8.8' "
executeCommandResult, err := frame.ExecCommandInPod(pod.Name, pod.Namespace, runGetIPString, ctx)
GinkgoWriter.Println("Execute command result: ", string(executeCommandResult))
Expect(err).NotTo(HaveOccurred(), "failed to execute command, error is: %v ", err)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC1)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC2), "Expected NIC %v mismatch", common.NIC2)

// ip r get <IP in eth0 subnet>, should flow out from eth0
GinkgoWriter.Println("ip -4 r get <IP in eth0 subnet>")
Expand Down Expand Up @@ -327,14 +327,14 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
ctx, cancel = context.WithTimeout(context.Background(), common.ExecCommandTimeout)
defer cancel()

// In this use case, the default routing NIC is specified as eth0 (originally the default is net1) through `CoordinatorSpec.PodDefaultRouteNIC`
// ip r get <address outside the cluster>, should flow out from the correct NIC(eth0).
// In this use case, the default routing NIC is specified as net1 (originally the default is eth0) through `CoordinatorSpec.PodDefaultRouteNIC`
// ip r get <address outside the cluster>, should flow out from the correct NIC(net1).
GinkgoWriter.Println("ip -6 r get <IP in service subnet>")
runGetIPString := "ip -6 r get '2401:2401::1' "
executeCommandResult, err := frame.ExecCommandInPod(pod.Name, pod.Namespace, runGetIPString, ctx)
GinkgoWriter.Println("Execute ipv6 command result: ", string(executeCommandResult))
Expect(err).NotTo(HaveOccurred(), "failed to execute ipv6 command, error is: %v ", err)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC1)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC2), "Expected NIC %v mismatch", common.NIC2)

// ip r get <IP in eth0 subnet>, should flow out from eth0
GinkgoWriter.Println("ip -6 r get <IP in eth0 subnet>")
Expand Down Expand Up @@ -724,7 +724,7 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
})
})

It("In the default scenario, the `ip rules` should be as expected and the default route should be on eth0", Label("C00011"), func() {
It("In the default scenario, the `ip rules` should be as expected and the default route should be on eth0", Label("C00011", "C00012"), func() {
podIppoolsAnno := types.AnnoPodIPPoolsValue{
types.AnnoIPPoolItem{
NIC: common.NIC2,
Expand Down Expand Up @@ -761,14 +761,14 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
defer cancel()

// In the conventional multi-card situation, the NIC where the default route is located is not specified through comments or other methods.
// Then when accessing the external address of the cluster, it should flow out from the net1 NIC.
// ip r get <address outside the cluster>, should flow out from the correct NIC(net1).
// Then when accessing the external address of the cluster, it should flow out from the eth0 NIC.
// ip r get <address outside the cluster>, should flow out from the correct NIC(eth0).
GinkgoWriter.Println("ip -4 r get <address outside the cluster>")
runGetIPString := "ip -4 r get '8.8.8.8' "
executeCommandResult, err := frame.ExecCommandInPod(pod.Name, pod.Namespace, runGetIPString, ctx)
GinkgoWriter.Println("Execute command result: ", string(executeCommandResult))
Expect(err).NotTo(HaveOccurred(), "failed to execute command, error is: %v ", err)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC2)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC1)

// ip r get <IP in eth0 subnet>, should flow out from eth0
GinkgoWriter.Println("ip -4 r get <IP in eth0 subnet>")
Expand Down Expand Up @@ -803,14 +803,14 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator")
defer cancel()

// In the conventional multi-card situation, the NIC where the default route is located is not specified through comments or other methods.
// Then when accessing the external address of the cluster, it should flow out from the net1 NIC.
// ip r get <address outside the cluster>, should flow out from the correct NIC(net1).
// Then when accessing the external address of the cluster, it should flow out from the eth0 NIC.
// ip r get <address outside the cluster>, should flow out from the correct NIC(eth0).
GinkgoWriter.Println("ip -6 r get <address outside the cluster>")
runGetIPString := "ip -6 r get '2401:2401::1' "
executeCommandResult, err := frame.ExecCommandInPod(pod.Name, pod.Namespace, runGetIPString, ctx)
GinkgoWriter.Println("Execute ipv6 command result: ", string(executeCommandResult))
Expect(err).NotTo(HaveOccurred(), "failed to execute ipv6 command, error is: %v ", err)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC2)
Expect(string(executeCommandResult)).Should(ContainSubstring(common.NIC1), "Expected NIC %v mismatch", common.NIC1)

// ip r get <IP in eth0 subnet>, should flow out from eth0
GinkgoWriter.Println("ip -6 r get <IP in eth0 subnet>")
Expand Down
Loading
Loading