- 
                Notifications
    
You must be signed in to change notification settings  - Fork 486
 
Add Import Policy for Service VIPs #721
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
Add Import Policy for Service VIPs #721
Conversation
83c935e    to
    b89a4b2      
    Compare
  
    b89a4b2    to
    acf35bb      
    Compare
  
    acf35bb    to
    cee75a7      
    Compare
  
    | 
           Awesome @aauren I will test it out and will revert back  | 
    
| 
           LGTM  | 
    
| 
           @ticpu Can you give a little more information? While some of the export policy logic got shuffled around so that combined logic happened at a higher level, the actual logic execution for the export policy side of things should be identical and the only added thing would be the addition of the import policies. Additionally, the function that is run on initial setup is the same function that is being called on the  Can you show maybe an abbreviated version of   | 
    
| 
           @aauren here are the tests results you requested, thanks to @danboucher78 who did the tests themselves. We can see there's a BGP route that disappear when the commit is included. It also disappears on the (Juniper) router side. Startup params for both testVersion 0.3.1-19-g972340e5Before syncSync logsAfter syncWithout commit 8fe9f70Before syncSync logsAfter sync | 
    
| 
           Thanks @ticpu! I'll go over this early next week and try to see what's happening!  | 
    
| 
           @ticpu thanks for reporting. I will test it out as well. Somehow I could not catch regression when I tested the PR  | 
    
| 
           @ticpu - I was able to reproduce what you mention. I think the reason why we didn't encounter this in our original testing was that we use a longer sync interval than you guys do in our configurations. I believe the reason why you only encounter this problem on sync interval is because in the logic of the  However, after a complete loop of the NRC, the policy is in place and ready to be enforced. On sync interval the NRC does a re-processing of advertisements and withdrawals. During this time, since the import policy now exists, GoBGP evaluates the externalIPs and clusterIPs against the import policy. They fail the import policy and the routes are not placed in the RIB. Because the routes are not placed in the RIB they are also not advertised upstream to route-reflectors or routers causing the route to be withdrawn. The logic of GoBGP in this area is explained here: https://github.com/osrg/gobgp/blob/master/docs/sources/policy.md#route-server-policy-model My faulty assumption here was that import policy would only be applied on incoming BGP advertisements that GoBGP received from other nodes in the cluster. However, I believe that GoBGP treats both local kube-router advertisements and remote advertisements the same with regards to the enforcement of import policy. My recommendation is that we revert this PR and enforce the import policy within the kube-router logic before we inject local routes into the kernel routing table in the NRC in this function: https://github.com/cloudnativelabs/kube-router/blob/master/pkg/controllers/routing/network_routes_controller.go#L408 I let @murali-reddy know about my findings and my recommendation in Slack. He is going to see if there are any other better options for either saving this patch or doing something different.  | 
    
This reverts commit 8fe9f70.
* rename export policies to make it direction independent * split creating neighborsets and prefixsets from applying export policy * add bgp import policy to deny service VIPs * add tests for addition of import policy
* rename export policies to make it direction independent * split creating neighborsets and prefixsets from applying export policy * add bgp import policy to deny service VIPs * add tests for addition of import policy (cherry picked from commit 8fe9f70)
@murali-reddy I finally got around to making good on an implementation for #633 based on your recommendation.
The main goal of this request is to add a BGP import policy that rejects cluster VIPs so that they don't get added to the local routing table and instead are routed via pure ECMP.
In the process of doing this, I found that there was quite a bit of logic crossover between the export policies and the import policies (all of the prefixset and neighborset stuff). So rather than duplicate the logic or make the function larger than it was already I broke
addImportPoliciesandaddExportPoliciesinto their own functions. This makes it easier to read and identify them as separate functionality. They are now called from a newAddPoliciesfunction that first sets up the common prefix and neighbor sets and then calls the import/export functions.Everything that used to call
addExportPolicieshas been converted to runAddPolicies.