Skip to content

Commit

Permalink
Fix for traffic not working in cluster mode (#3359)
Browse files Browse the repository at this point in the history
  • Loading branch information
vklohiya authored Mar 29, 2024
1 parent 721bc25 commit f16692d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/node_poll_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (ctlr *Controller) processStaticRouteUpdate() {
}
l3Forward := networkmanager.L3Forward{
Config: networkmanager.StaticRouteConfig{},
VLANs: []int{},
VRF: networkmanager.DefaultL3Network,
}
// For ovn-k8s get pod subnet and node ip from annotation
if ctlr.OrchestrationCNI == OVN_K8S {
Expand Down
9 changes: 6 additions & 3 deletions pkg/networkmanager/networkmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
networkManagerPrefix = "[NetworkManager]"
timeoutSmall = 2 * time.Second
timeoutLarge = 180 * time.Second
DefaultL3Network = "Default L3-Network"
)

// NetworkManager is responsible for managing the network objects on central manager.
Expand Down Expand Up @@ -56,7 +57,7 @@ type (
// L3Forward struct represents the structure of the L3Forward in the JSON response
L3Forward struct {
ID string `json:"id,omitempty"`
VLANs []int `json:"vlans"`
VRF string `json:"vrf"`
Name string `json:"name"`
Config StaticRouteConfig `json:"config"`
}
Expand Down Expand Up @@ -247,12 +248,14 @@ func (nm *NetworkManager) GetL3ForwardsFromInstance(instanceId string, controlle
config.L3ForwardType, _ = configData["l3ForwardType"].(string)
}

if idOk && nameOk {
vrfData, vrfOk := l3Forward["payload"].(map[string]interface{})["vrf"].(string)

if idOk && nameOk && vrfOk {
staticRoutes[config] = L3Forward{
ID: id,
Name: name,
Config: config,
VLANs: []int{},
VRF: vrfData,
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions pkg/networkmanager/networkmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ var _ = Describe("Network Manager Tests", func() {
Destination: "10.244.0.0/24",
L3ForwardType: L3RouteGateway,
},
VLANs: []int{},
Name: "test",
VRF: DefaultL3Network,
Name: "test",
}
// Mock the server
server = ghttp.NewServer()
Expand Down Expand Up @@ -198,8 +198,8 @@ var _ = Describe("Network Manager Tests", func() {
Destination: "10.244.0.0/24",
L3ForwardType: L3RouteGateway,
},
VLANs: []int{},
Name: "test",
VRF: DefaultL3Network,
Name: "test",
}
// Mock the server
server = ghttp.NewServer()
Expand Down Expand Up @@ -369,8 +369,8 @@ var _ = Describe("Network Manager Tests", func() {
Destination: "10.244.0.0/24",
L3ForwardType: L3RouteGateway,
},
VLANs: []int{},
Name: "test",
VRF: DefaultL3Network,
Name: "test",
}
// Mock the server
server = ghttp.NewServer()
Expand Down Expand Up @@ -417,12 +417,13 @@ var _ = Describe("Network Manager Tests", func() {
"gateway": "10.4.0.234",
"destination": "10.244.0.0/24",
"l3ForwardType": "L3RouteGateway"
}
},
"vrf": "%s"
}
}
]
}
}`, L3ForwardId, BigIpId)
}`, L3ForwardId, BigIpId, DefaultL3Network)
server.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest("GET", InstancesURI+BigIpId+L3Forwards),
Expand Down

0 comments on commit f16692d

Please sign in to comment.