@@ -1371,7 +1371,7 @@ func flowsForDefaultBridge(bridge *bridgeConfiguration, extraIPs []net.IP) ([]st
13711371 return dftFlows , nil
13721372}
13731373
1374- func commonFlows (subnets []* net.IPNet , bridge * bridgeConfiguration ) ([]string , error ) {
1374+ func commonFlows (subnets , hostSubnets []* net.IPNet , bridge * bridgeConfiguration ) ([]string , error ) {
13751375 // CAUTION: when adding new flows where the in_port is ofPortPatch and the out_port is ofPortPhys, ensure
13761376 // that dl_src is included in match criteria!
13771377 ofPortPhys := bridge .ofPortPhys
@@ -1432,7 +1432,7 @@ func commonFlows(subnets []*net.IPNet, bridge *bridgeConfiguration) ([]string, e
14321432
14331433 // Allow OVN->Host traffic on the same node
14341434 if config .Gateway .Mode == config .GatewayModeShared || config .Gateway .Mode == config .GatewayModeLocal {
1435- dftFlows = append (dftFlows , ovnToHostNetworkNormalActionFlows (netConfig , bridgeMacAddress , subnets , false )... )
1435+ dftFlows = append (dftFlows , ovnToHostNetworkNormalActionFlows (netConfig , bridgeMacAddress , hostSubnets , false )... )
14361436 }
14371437 } else {
14381438 // for UDN we additionally SNAT the packet from masquerade IP -> node IP
@@ -1512,7 +1512,7 @@ func commonFlows(subnets []*net.IPNet, bridge *bridgeConfiguration) ([]string, e
15121512
15131513 // Allow OVN->Host traffic on the same node
15141514 if config .Gateway .Mode == config .GatewayModeShared || config .Gateway .Mode == config .GatewayModeLocal {
1515- dftFlows = append (dftFlows , ovnToHostNetworkNormalActionFlows (netConfig , bridgeMacAddress , subnets , true )... )
1515+ dftFlows = append (dftFlows , ovnToHostNetworkNormalActionFlows (netConfig , bridgeMacAddress , hostSubnets , true )... )
15161516 }
15171517 } else {
15181518 // for UDN we additionally SNAT the packet from masquerade IP -> node IP
@@ -1771,11 +1771,11 @@ func setBridgeOfPorts(bridge *bridgeConfiguration) error {
17711771
17721772// initSvcViaMgmPortRoutingRules creates the svc2managementport routing table, routes and rules
17731773// that let's us forward service traffic to ovn-k8s-mp0 as opposed to the default route towards breth0
1774- func initSvcViaMgmPortRoutingRules (hostSubnets []* net.IPNet ) error {
1774+ func initSvcViaMgmPortRoutingRules (subnets []* net.IPNet ) error {
17751775 // create ovnkubeSvcViaMgmPortRT and service route towards ovn-k8s-mp0
1776- for _ , hostSubnet := range hostSubnets {
1777- isIPv6 := utilnet .IsIPv6CIDR (hostSubnet )
1778- gatewayIP := util .GetNodeGatewayIfAddr (hostSubnet ).IP .String ()
1776+ for _ , subnet := range subnets {
1777+ isIPv6 := utilnet .IsIPv6CIDR (subnet )
1778+ gatewayIP := util .GetNodeGatewayIfAddr (subnet ).IP .String ()
17791779 for _ , svcCIDR := range config .Kubernetes .ServiceCIDRs {
17801780 if isIPv6 == utilnet .IsIPv6CIDR (svcCIDR ) {
17811781 if stdout , stderr , err := util .RunIP ("route" , "replace" , "table" , ovnkubeSvcViaMgmPortRT , svcCIDR .String (), "via" , gatewayIP , "dev" , types .K8sMgmtIntfName ); err != nil {
@@ -1895,7 +1895,7 @@ func newSharedGateway(nodeName string, subnets []*net.IPNet, gwNextHops []net.IP
18951895 }
18961896 }
18971897 gw .nodeIPManager = newAddressManager (nodeName , kube , cfg , watchFactory , gwBridge )
1898- nodeIPs , _ := gw .nodeIPManager .ListAddresses ()
1898+ hostIPs , hostSubnets := gw .nodeIPManager .ListAddresses ()
18991899
19001900 if config .OvnKubeNode .Mode == types .NodeModeFull {
19011901 // Delete stale masquerade resources if there are any. This is to make sure that there
@@ -1919,7 +1919,7 @@ func newSharedGateway(nodeName string, subnets []*net.IPNet, gwNextHops []net.IP
19191919 }
19201920 }
19211921
1922- gw .openflowManager , err = newGatewayOpenFlowManager (gwBridge , exGwBridge , subnets , nodeIPs )
1922+ gw .openflowManager , err = newGatewayOpenFlowManager (gwBridge , exGwBridge , subnets , hostSubnets , hostIPs )
19231923 if err != nil {
19241924 return err
19251925 }
@@ -1928,7 +1928,7 @@ func newSharedGateway(nodeName string, subnets []*net.IPNet, gwNextHops []net.IP
19281928 gw .nodeIPManager .OnChanged = func () {
19291929 klog .V (5 ).Info ("Node addresses changed, re-syncing bridge flows" )
19301930 nodeIPs , _ := gw .nodeIPManager .ListAddresses ()
1931- if err := gw .openflowManager .updateBridgeFlowCache (subnets , nodeIPs ); err != nil {
1931+ if err := gw .openflowManager .updateBridgeFlowCache (subnets , hostSubnets , nodeIPs ); err != nil {
19321932 // very unlikely - somehow node has lost its IP address
19331933 klog .Errorf ("Failed to re-generate gateway flows after address change: %v" , err )
19341934 }
0 commit comments