Skip to content

Prioritise static BGP filters over user defined ones #10457

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions confd/etc/calico/confd/templates/bird.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ protocol bgp Global_{{$id}} from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
{{- range $filter := $data.filters }}
{{- $filterKey := printf "/resources/v3/projectcalico.org/bgpfilters/%s" $filter }}
{{- if exists $filterKey }}
Expand All @@ -261,7 +262,6 @@ protocol bgp Global_{{$id}} from bgp_template {
{{- end }}
{{- end }}
{{- end }}
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
reject;{{/* Prior to introduction of BGP Filters anything not explicitly exported through calico_export_to_bgp_peers()
was rejected so use default reject behaviour on export */}}
}; # Only want to export routes for workloads.
Expand Down Expand Up @@ -333,6 +333,7 @@ protocol bgp Local_Workload_{{$id}} from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
{{- range $filter := $data.filters }}
{{- $filterKey := printf "/resources/v3/projectcalico.org/bgpfilters/%s" $filter }}
{{- if exists $filterKey }}
Expand All @@ -342,7 +343,6 @@ protocol bgp Local_Workload_{{$id}} from bgp_template {
{{- end }}
{{- end }}
{{- end }}
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
reject;{{/* Prior to introduction of BGP Filters anything not explicitly exported through calico_export_to_bgp_peers()
was rejected so use default reject behaviour on export */}}
}; # Only want to export routes for workloads.
Expand Down Expand Up @@ -414,6 +414,7 @@ protocol bgp Node_{{$id}} from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
{{- range $filter := $data.filters }}
{{- $filterKey := printf "/resources/v3/projectcalico.org/bgpfilters/%s" $filter }}
{{- if exists $filterKey }}
Expand All @@ -423,7 +424,6 @@ protocol bgp Node_{{$id}} from bgp_template {
{{- end }}
{{- end }}
{{- end }}
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
reject;{{/* Prior to introduction of BGP Filters anything not explicitly exported through calico_export_to_bgp_peers()
was rejected so use default reject behaviour on export */}}
}; # Only want to export routes for workloads.
Expand Down Expand Up @@ -493,6 +493,7 @@ protocol bgp Local_Workload_{{$id}} from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
{{- range $filter := $data.filters }}
{{- $filterKey := printf "/resources/v3/projectcalico.org/bgpfilters/%s" $filter }}
{{- if exists $filterKey }}
Expand All @@ -502,7 +503,6 @@ protocol bgp Local_Workload_{{$id}} from bgp_template {
{{- end }}
{{- end }}
{{- end }}
calico_export_to_bgp_peers({{eq $data.as_num $node_as_num}});
reject;{{/* Prior to introduction of BGP Filters anything not explicitly exported through calico_export_to_bgp_peers()
was rejected so use default reject behaviour on export */}}
}; # Only want to export routes for workloads.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ function 'bgp_export-only-filter-2_exportFilterV4'() {
# No global peers configured.




# ------------- Node-specific peers -------------


Expand All @@ -98,8 +100,8 @@ protocol bgp Node_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_export-only-filter-1_exportFilterV4'();
calico_export_to_bgp_peers(false);
'bgp_export-only-filter-1_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -115,11 +117,24 @@ protocol bgp Node_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_export-only-filter-2_exportFilterV4'();
calico_export_to_bgp_peers(false);
'bgp_export-only-filter-2_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
















Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_export-only-filter_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_export-only-filter_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -107,16 +107,34 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_export-only-filter_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_export-only-filter_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -115,16 +115,34 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





22 changes: 20 additions & 2 deletions confd/tests/compiled_templates/bgpfilter/filter_names/bird.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers(true);
'bgp_45characters.exactly.so.should.not.truncate-1_exportFilterV4'();
'bgp_46characters.exactly.so.shou_9615CBDC00BAC628_exportFilterV4'();
'bgp_greater-than-64-characters.s_4C5DB3273E544641_exportFilterV4'();
calico_export_to_bgp_peers(true);
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -135,18 +135,36 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
calico_export_to_bgp_peers(true);
'bgp_45characters.exactly.so.should.not.truncate-1_exportFilterV4'();
'bgp_46characters.exactly.so.shou_9615CBDC00BAC628_exportFilterV4'();
'bgp_greater-than-64-characters.s_4C5DB3273E544641_exportFilterV4'();
calico_export_to_bgp_peers(true);
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-interface_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-interface_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -115,16 +115,34 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-interface_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-interface_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-operators_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-operators_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -115,16 +115,34 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-operators_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-operators_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





22 changes: 20 additions & 2 deletions confd/tests/compiled_templates/bgpfilter/match_source/bird.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ protocol bgp Global_10_192_0_3 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-source_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-source_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}
Expand All @@ -111,16 +111,34 @@ protocol bgp Global_10_192_0_4 from bgp_template {
accept; # Prior to introduction of BGP Filters we used "import all" so use default accept behaviour on import
};
export filter {
'bgp_test-filter-match-source_exportFilterV4'();
calico_export_to_bgp_peers(true);
'bgp_test-filter-match-source_exportFilterV4'();
reject;
}; # Only want to export routes for workloads.
}


















# ------------- Node-specific peers -------------

# No node-specific peers configured.





Loading
Loading