Skip to content

Commit

Permalink
Merge pull request #2425 from ty-dc/e2e/new-3
Browse files Browse the repository at this point in the history
Add and improve the e2e use case of the NIC where the default route is located
  • Loading branch information
weizhoublue authored Oct 18, 2023
2 parents 5d69581 + 6fdf4fb commit 2874eed
Show file tree
Hide file tree
Showing 5 changed files with 332 additions and 22 deletions.
12 changes: 10 additions & 2 deletions cmd/coordinator/cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,11 @@ func (c *coordinator) tunePodRoutes(logger *zap.Logger, configDefaultRouteNIC st

if configDefaultRouteNIC == c.currentInterface {
for idx, route := range defaultInterfaceRoutes {
if route.Dst != nil {
zeroIPAddress := net.IPv4zero
if defaultInterfaceRoutes[idx].Family == netlink.FAMILY_V6 {
zeroIPAddress = net.IPv6zero
}
if !route.Dst.IP.Equal(zeroIPAddress) {
if err := networking.AddToRuleTable(defaultInterfaceRoutes[idx].Dst, c.currentRuleTable); err != nil {
logger.Error("failed to AddToRuleTable", zap.Error(err))
return fmt.Errorf("failed to AddToRuleTable: %v", err)
Expand All @@ -453,7 +457,11 @@ func (c *coordinator) tunePodRoutes(logger *zap.Logger, configDefaultRouteNIC st

} else if configDefaultRouteNIC == podDefaultRouteNIC {
for idx, route := range currentInterfaceRoutes {
if route.Dst != nil {
zeroIPAddress := net.IPv4zero
if defaultInterfaceRoutes[idx].Family == netlink.FAMILY_V6 {
zeroIPAddress = net.IPv6zero
}
if !route.Dst.IP.Equal(zeroIPAddress) {
if err := networking.AddToRuleTable(currentInterfaceRoutes[idx].Dst, c.currentRuleTable); err != nil {
logger.Error("failed to AddToRuleTable", zap.Error(err))
return fmt.Errorf("failed to AddToRuleTable: %v", err)
Expand Down
9 changes: 9 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ setup_spiderpool:
fi ; \
if [ "$(E2E_SPIDERPOOL_ENABLE_COORDINATOR)" == "true" ] ; then \
HELM_OPTION+=" --set coordinator.enabled=true " ; \
if [ "$(INSTALL_CILIUM)" == "true" ] ; then \
if [ "$(E2E_IP_FAMILY)" == "ipv4" ] ; then \
HELM_OPTION+=" --set coordinator.hijackCIDR={$(CILIUM_CLUSTER_POD_SUBNET_V4)} " ; \
elif [ "$(E2E_IP_FAMILY)" == "ipv6" ] ; then \
HELM_OPTION+=" --set coordinator.hijackCIDR={$(CILIUM_CLUSTER_POD_SUBNET_V6)} " ; \
else \
HELM_OPTION+=" --set coordinator.hijackCIDR={$(CILIUM_CLUSTER_POD_SUBNET_V4),$(CILIUM_CLUSTER_POD_SUBNET_V6)} " ; \
fi ; \
fi ; \
else \
HELM_OPTION+=" --set coordinator.enabled=false " ; \
fi ; \
Expand Down
5 changes: 3 additions & 2 deletions test/doc/coordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
| 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 where the default route is located | p2 | | done | |
| C00006 | In underlay mode: specify the NIC where the default route is located | p2 | | | |
| 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 | | | |
| 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 | | |
6 changes: 6 additions & 0 deletions test/e2e/common/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const (
SpiderPoolConfigmapNameSpace = "kube-system"
)

// Kubeadm configurations
const (
KubeadmConfigmapName = "kubeadm-config"
KubeadmConfigmapNameSpace = "kube-system"
)

// Network configurations
var (
// multus CNI
Expand Down
Loading

0 comments on commit 2874eed

Please sign in to comment.