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

agent: memif and vcl fixes #662

Merged
merged 2 commits into from
Dec 7, 2023
Merged

agent: memif and vcl fixes #662

merged 2 commits into from
Dec 7, 2023

Conversation

hedibouattour
Copy link
Collaborator

No description provided.

@hedibouattour hedibouattour force-pushed the memifandvclfixes branch 2 times, most recently from 9cc9a5c to 1a497c8 Compare November 29, 2023 09:30
Copy link
Collaborator

@sknat sknat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR,
As this codepath is getting a bit complex, it might be worth doing a bit of extra refactoring along the way, so that

pblswIfIndex, pblIsL3 := podSpec.GetParamsForIfType(podSpec.PortFilteredIfType)
swIfIndex, isL3 = podSpec.GetParamsForIfType(podSpec.DefaultIfType)
if podSpec.EnableVCL {
  err = s.SetupPuntRoutes(podSpec, stack, podSpec.TunTapSwIfIndex)
  err = s.AddRouteNetworkVRFToPodVRF(podSpec, stack)
} else if pblswIfIndex != types.InvalidID  {
  err = s.AddRoutePodVRFtoPodInterface()
  err = s.AddRouteNetworkVRFToPodVRF(podSpec, stack)
} else {
  err = s.AddRouteNetworkVRFtoPodInterface()
}

And remove the logging from the AddVppInterface function to have it only in the AddRoute...To...() functions. What do you think ?

if err != nil {
goto err
}
} else {
s.log.Warn("No default if type for pod")
}
if pblswIfIndex != types.InvalidID {
err = s.CreateVRFRoutesToPod(podSpec, stack)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe CreateVRFRoutesToPod -> AddRouteNetworkVRFToPodVRF

swIfIndex, isL3 = podSpec.GetParamsForIfType(podSpec.DefaultIfType)
if swIfIndex != types.InvalidID {
s.log.Infof("pod(add) Default routes to swIfIndex=%d isL3=%t", swIfIndex, isL3)
err = s.RoutePodInterface(podSpec, stack, swIfIndex, isL3)
err = s.RoutePodInterface(podSpec, stack, swIfIndex, isL3, pblswIfIndex != types.InvalidID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a inPodVRF it might be better to have two functions :

  • AddRouteNetworkVRFtoPodInterface()
  • AddRoutePodVRFtoPodInterface()

@@ -210,16 +210,23 @@ func (s *Server) AddVppInterface(podSpec *storage.LocalPodSpec, doHostSideConf b
goto err
}
} else {
pblswIfIndex, _ := podSpec.GetParamsForIfType(podSpec.PortFilteredIfType)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If might be worth adding a

pblswIfIndex, pblIsL3 := podSpec.GetParamsForIfType(podSpec.PortFilteredIfType)
swIfIndex, isL3 = podSpec.GetParamsForIfType(podSpec.DefaultIfType)

at the beginning of the /* Routes */ section

@sknat
Copy link
Collaborator

sknat commented Dec 7, 2023

Actually with the release proximity and as this fixes memif/VCL, let's maybe merge this PR and keep the refactoring for a later PR.

@sknat sknat merged commit 40f4b2e into master Dec 7, 2023
5 checks passed
@sknat sknat deleted the memifandvclfixes branch December 7, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants