Skip to content

Commit 31d2803

Browse files
Merge pull request #2627 from trozet/merge-6-10-25
OCPBUGS-44481: DownStream Merge [06-10-2025]
2 parents 36e5a1d + cc497ec commit 31d2803

37 files changed

+1199
-486
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ jobs:
200200
if: steps.is_pr_image_build_needed.outputs.PR_IMAGE_RESTORED != 'true' && success()
201201
run: |
202202
set -x
203+
sudo apt update
203204
sudo apt-get install linux-modules-extra-$(uname -r) -y
204205
sudo modprobe vrf
205206
@@ -463,15 +464,15 @@ jobs:
463464
- {"target": "network-segmentation", "ha": "noHA", "gateway-mode": "shared", "ipfamily": "ipv4", "disable-snat-multiple-gws": "noSnatGW", "second-bridge": "1br", "ic": "ic-single-node-zones"}
464465
- {"target": "network-segmentation", "ha": "noHA", "gateway-mode": "shared", "ipfamily": "ipv6", "disable-snat-multiple-gws": "noSnatGW", "second-bridge": "1br", "ic": "ic-single-node-zones"}
465466
- {"target": "bgp", "ha": "noHA", "gateway-mode": "local", "ipfamily": "dualstack", "disable-snat-multiple-gws": "snatGW", "second-bridge": "1br", "ic": "ic-single-node-zones", "routeadvertisements": "advertise-default", "network-segmentation": "enable-network-segmentation"}
466-
- {"target": "bgp", "ha": "noHA", "gateway-mode": "shared", "ipfamily": "ipv4", "disable-snat-multiple-gws": "snatGW", "second-bridge": "1br", "ic": "ic-single-node-zones", "routeadvertisements": "advertise-default", "network-segmentation": "enable-network-segmentation"}
467+
- {"target": "bgp", "ha": "noHA", "gateway-mode": "shared", "ipfamily": "dualstack", "disable-snat-multiple-gws": "noSnatGW", "second-bridge": "1br", "ic": "ic-single-node-zones", "routeadvertisements": "advertise-default", "network-segmentation": "enable-network-segmentation"}
467468
- {"target": "traffic-flow-test-only","ha": "noHA", "gateway-mode": "shared", "ipfamily": "ipv4", "disable-snat-multiple-gws": "noSnatGW", "second-bridge": "1br", "ic": "ic-single-node-zones", "traffic-flow-tests": "1-24", "network-segmentation": "enable-network-segmentation"}
468469
- {"target": "tools", "ha": "noHA", "gateway-mode": "local", "ipfamily": "dualstack", "disable-snat-multiple-gws": "SnatGW", "second-bridge": "1br", "ic": "ic-single-node-zones", "network-segmentation": "enable-network-segmentation"}
469470
needs: [ build-pr ]
470471
env:
471472
JOB_NAME: "${{ matrix.target }}-${{ matrix.ha }}-${{ matrix.gateway-mode }}-${{ matrix.ipfamily }}-${{ matrix.disable-snat-multiple-gws }}-${{ matrix.second-bridge }}-${{ matrix.ic }}"
472473
OVN_HYBRID_OVERLAY_ENABLE: ${{ (matrix.target == 'control-plane' || matrix.target == 'control-plane-helm') && (matrix.ipfamily == 'ipv4' || matrix.ipfamily == 'dualstack' ) }}
473-
OVN_MULTICAST_ENABLE: "${{ matrix.target == 'control-plane' || matrix.target == 'control-plane-helm' || matrix.target == 'network-segmentation' }}"
474-
OVN_EMPTY_LB_EVENTS: "${{ matrix.target == 'control-plane' || matrix.target == 'control-plane-helm' }}"
474+
OVN_MULTICAST_ENABLE: "${{ matrix.target == 'control-plane' || matrix.target == 'control-plane-helm' || matrix.target == 'network-segmentation' || matrix.target == 'bgp' }}"
475+
OVN_EMPTY_LB_EVENTS: "${{ matrix.target == 'control-plane' || matrix.target == 'control-plane-helm' || matrix.target == 'bgp' }}"
475476
OVN_HA: "${{ matrix.ha == 'HA' }}"
476477
OVN_DISABLE_SNAT_MULTIPLE_GWS: "${{ matrix.disable-snat-multiple-gws == 'noSnatGW' }}"
477478
KIND_INSTALL_METALLB: "${{ matrix.target == 'control-plane' || matrix.target == 'control-plane-helm' || matrix.target == 'network-segmentation' }}"
@@ -500,6 +501,7 @@ jobs:
500501
- name: Install VRF kernel module
501502
run: |
502503
set -x
504+
sudo apt update
503505
sudo apt-get install linux-modules-extra-$(uname -r) -y
504506
sudo modprobe vrf
505507
@@ -557,7 +559,7 @@ jobs:
557559
echo OVN_TEST_EX_GW_NETWORK=xgw >> $GITHUB_ENV
558560
echo OVN_ENABLE_EX_GW_NETWORK_BRIDGE=true >> $GITHUB_ENV
559561
fi
560-
if [[ "$JOB_NAME" == *"shard-conformance"* ]] && [ "$ADVERTISE_DEFAULT_NETWORK" == "true" ]; then
562+
if [ "$ADVERTISE_DEFAULT_NETWORK" == "true" ]; then
561563
echo "ADVERTISE_DEFAULT_NETWORK=true" >> $GITHUB_ENV
562564
563565
# Use proper variable declaration with default values
@@ -614,7 +616,9 @@ jobs:
614616
- name: Run Tests
615617
# e2e tests take ~60 minutes normally, 120 should be more than enough
616618
# set 3 hours for control-plane tests as these might take a while
617-
timeout-minutes: ${{ matrix.target == 'control-plane' && 180 || matrix.target == 'control-plane-helm' && 180 || matrix.target == 'external-gateway' && 180 || 120 }}
619+
# give 10m extra to give ginkgo chance to timeout before github so that we
620+
# get its output
621+
timeout-minutes: ${{ matrix.target == 'bgp' && 190 || matrix.target == 'control-plane' && 190 || matrix.target == 'control-plane-helm' && 190 || matrix.target == 'external-gateway' && 190 || 130 }}
618622
run: |
619623
# used by e2e diagnostics package
620624
export OVN_IMAGE="ovn-daemonset-fedora:pr"
@@ -639,7 +643,7 @@ jobs:
639643
elif [ "${{ matrix.target }}" == "network-segmentation" ]; then
640644
make -C test control-plane WHAT="Network Segmentation"
641645
elif [ "${{ matrix.target }}" == "bgp" ]; then
642-
make -C test control-plane WHAT="BGP"
646+
make -C test control-plane
643647
elif [ "${{ matrix.target }}" == "tools" ]; then
644648
make -C go-controller build
645649
make -C test tools

contrib/kind-common

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,13 @@ deploy_bgp_external_server() {
751751
echo "FRR kind network IPv6: ${bgp_network_frr_v6}"
752752
$OCI_BIN exec bgpserver ip -6 route replace default via "$bgp_network_frr_v6"
753753
fi
754+
# disable the default route to make sure the container only routes accross
755+
# directly connected or learnt networks (doing this at the very end since
756+
# docker changes the routing table when a new network is connected)
757+
docker exec frr ip route delete default
758+
docker exec frr ip route
759+
docker exec frr ip -6 route delete default
760+
docker exec frr ip -6 route
754761
}
755762

756763
destroy_bgp() {
@@ -817,7 +824,7 @@ EOF
817824

818825
rm -rf "${FRR_TMP_DIR}"
819826
# Add routes for pod networks dynamically into the github runner for return traffic to pass back
820-
if [ -n "${JOB_NAME:-}" ] && [[ "$JOB_NAME" == *"shard-conformance"* ]] && [ "$ADVERTISE_DEFAULT_NETWORK" == "true" ]; then
827+
if [ "$ADVERTISE_DEFAULT_NETWORK" = "true" ]; then
821828
echo "Adding routes for Kubernetes pod networks..."
822829
NODES=$(kubectl get nodes -o jsonpath='{.items[*].metadata.name}')
823830
echo "Found nodes: $NODES"
@@ -835,7 +842,7 @@ EOF
835842
# Add IPv4 route
836843
if [ -n "$ipv4_subnet" ] && [ -n "$node_ipv4" ]; then
837844
echo "Adding IPv4 route for $node ($node_ipv4): $ipv4_subnet"
838-
sudo ip route add $ipv4_subnet via $node_ipv4
845+
sudo ip route replace $ipv4_subnet via $node_ipv4
839846
fi
840847
fi
841848

@@ -847,7 +854,7 @@ EOF
847854

848855
if [ -n "$ipv6_subnet" ] && [ -n "$node_ipv6" ]; then
849856
echo "Adding IPv6 route for $node ($node_ipv6): $ipv6_subnet"
850-
sudo ip -6 route add $ipv6_subnet via $node_ipv6
857+
sudo ip -6 route replace $ipv6_subnet via $node_ipv6
851858
fi
852859
fi
853860
done

go-controller/pkg/clustermanager/userdefinednetwork/template/net-attach-def-template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func renderCNINetworkConfig(networkName, nadName string, spec SpecGetter) (map[s
192192
cniNetConf["mtu"] = mtu
193193
}
194194
if len(netConfSpec.JoinSubnet) > 0 {
195-
cniNetConf["joinSubnets"] = netConfSpec.JoinSubnet
195+
cniNetConf["joinSubnet"] = netConfSpec.JoinSubnet
196196
}
197197
if len(netConfSpec.Subnets) > 0 {
198198
cniNetConf["subnets"] = netConfSpec.Subnets

go-controller/pkg/clustermanager/userdefinednetwork/template/net-attach-def-template_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
326326
"netAttachDefName": "mynamespace/test-net",
327327
"role": "primary",
328328
"topology": "layer3",
329-
"joinSubnets": "100.65.0.0/16,fd99::/64",
329+
"joinSubnet": "100.65.0.0/16,fd99::/64",
330330
"subnets": "192.168.100.0/16,2001:dbb::/60",
331331
"mtu": 1500
332332
}`,
@@ -350,7 +350,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
350350
"netAttachDefName": "mynamespace/test-net",
351351
"role": "primary",
352352
"topology": "layer2",
353-
"joinSubnets": "100.65.0.0/16,fd99::/64",
353+
"joinSubnet": "100.65.0.0/16,fd99::/64",
354354
"subnets": "192.168.100.0/24,2001:dbb::/64",
355355
"mtu": 1500,
356356
"allowPersistentIPs": true
@@ -376,7 +376,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
376376
"netAttachDefName": "mynamespace/test-net",
377377
"role": "primary",
378378
"topology": "layer2",
379-
"joinSubnets": "100.62.0.0/24,fd92::/64",
379+
"joinSubnet": "100.62.0.0/24,fd92::/64",
380380
"subnets": "192.168.100.0/24,2001:dbb::/64",
381381
"mtu": 1500,
382382
"allowPersistentIPs": true
@@ -461,7 +461,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
461461
"netAttachDefName": "mynamespace/test-net",
462462
"role": "primary",
463463
"topology": "layer3",
464-
"joinSubnets": "100.65.0.0/16,fd99::/64",
464+
"joinSubnet": "100.65.0.0/16,fd99::/64",
465465
"subnets": "192.168.100.0/16,2001:dbb::/60",
466466
"mtu": 1500
467467
}`,
@@ -485,7 +485,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
485485
"netAttachDefName": "mynamespace/test-net",
486486
"role": "primary",
487487
"topology": "layer2",
488-
"joinSubnets": "100.65.0.0/16,fd99::/64",
488+
"joinSubnet": "100.65.0.0/16,fd99::/64",
489489
"subnets": "192.168.100.0/24,2001:dbb::/64",
490490
"mtu": 1500,
491491
"allowPersistentIPs": true
@@ -511,7 +511,7 @@ var _ = Describe("NetAttachDefTemplate", func() {
511511
"netAttachDefName": "mynamespace/test-net",
512512
"role": "primary",
513513
"topology": "layer2",
514-
"joinSubnets": "100.62.0.0/24,fd92::/64",
514+
"joinSubnet": "100.62.0.0/24,fd92::/64",
515515
"subnets": "192.168.100.0/24,2001:dbb::/64",
516516
"mtu": 1500,
517517
"allowPersistentIPs": true

go-controller/pkg/kubevirt/router.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,16 @@ func EnsureLocalZonePodAddressesToNodeRoute(watchFactory *factory.WatchFactory,
9595
if config.OVNKubernetesFeature.EnableInterconnect {
9696
// NOTE: EIP & ESVC use same route and if this is already present thanks to those features,
9797
// this will be a no-op
98-
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, types.OVNClusterRouter, types.GWRouterPrefix+pod.Spec.NodeName, clusterSubnets); err != nil {
98+
node, err := watchFactory.GetNode(pod.Spec.NodeName)
99+
if err != nil {
100+
return fmt.Errorf("failed getting to list node %q for pod %s/%s: %w", pod.Spec.NodeName, pod.Namespace, pod.Name, err)
101+
}
102+
gatewayIPs, err := util.ParseNodeGatewayRouterJoinAddrs(node, types.DefaultNetworkName)
103+
if err != nil {
104+
return fmt.Errorf("failed to get default network gateway router join IPs for node %q: %w", node.Name, err)
105+
}
106+
if err := libovsdbutil.CreateDefaultRouteToExternal(nbClient, types.OVNClusterRouter,
107+
types.GWRouterPrefix+pod.Spec.NodeName, clusterSubnets, gatewayIPs); err != nil {
99108
return err
100109
}
101110
}

go-controller/pkg/libovsdb/util/router.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
1414
libovsdbops "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops"
1515
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb"
16-
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types"
1716
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
1817
)
1918

@@ -34,11 +33,7 @@ import (
3433
// (TODO: FIXME): With this route, we are officially breaking support for IC with zones that have multiple-nodes
3534
// NOTE: This route is exactly the same as what is added by pod-live-migration feature and we keep the route exactly
3635
// same across the 3 features so that if the route already exists on the node, this is just a no-op
37-
func CreateDefaultRouteToExternal(nbClient libovsdbclient.Client, clusterRouter, gwRouterName string, clusterSubnets []config.CIDRNetworkEntry) error {
38-
gatewayIPs, err := GetLRPAddrs(nbClient, types.GWRouterToJoinSwitchPrefix+gwRouterName)
39-
if err != nil {
40-
return fmt.Errorf("attempt at finding node gateway router %s network information failed, err: %w", gwRouterName, err)
41-
}
36+
func CreateDefaultRouteToExternal(nbClient libovsdbclient.Client, clusterRouter, gwRouterName string, clusterSubnets []config.CIDRNetworkEntry, gatewayIPs []*net.IPNet) error {
4237
for _, clusterSubnet := range clusterSubnets {
4338
isClusterSubnetIPV6 := utilnet.IsIPv6String(clusterSubnet.CIDR.IP.String())
4439
gatewayIP, err := util.MatchFirstIPNetFamily(isClusterSubnetIPV6, gatewayIPs)

go-controller/pkg/libovsdb/util/router_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ func TestCreateDefaultRouteToExternal(t *testing.T) {
3131
gwRouterPortName := types.GWRouterToJoinSwitchPrefix + gwRouterName
3232
gwRouterIPAddressV4 := "100.64.0.3"
3333
gwRouterIPAddressV6 := "fd98::3"
34+
gwRouterIPAddressV4CIDR := fmt.Sprintf("%s/32", gwRouterIPAddressV4)
35+
gwRouterIPAddressV6CIDR := fmt.Sprintf("%s/128", gwRouterIPAddressV6)
36+
gatewayIPs := []*net.IPNet{ovntest.MustParseIPNet(gwRouterIPAddressV4CIDR), ovntest.MustParseIPNet(gwRouterIPAddressV6CIDR)}
3437
gwRouterPort := &nbdb.LogicalRouterPort{
3538
UUID: gwRouterPortName + "-uuid",
3639
Name: gwRouterPortName,
@@ -228,7 +231,7 @@ func TestCreateDefaultRouteToExternal(t *testing.T) {
228231
tc.preTestAction()
229232
}
230233

231-
if err = CreateDefaultRouteToExternal(nbClient, ovnClusterRouterName, gwRouterName, config.Default.ClusterSubnets); err != nil {
234+
if err = CreateDefaultRouteToExternal(nbClient, ovnClusterRouterName, gwRouterName, config.Default.ClusterSubnets, gatewayIPs); err != nil {
232235
t.Fatal(fmt.Errorf("failed to run CreateDefaultRouteToExternal: %v", err))
233236
}
234237

0 commit comments

Comments
 (0)