Basic support for BGP communities in calico
This creates a new section in calico/values.yaml that enables BGP communities to be applied to a cidr by using the bird_ipam templates. Change-Id: I4dbbc8d8e761e0484eeb7c8bf0fefa28d29493e5
This commit is contained in:
parent
2a3740f349
commit
e34270c51e
@ -8,7 +8,23 @@ function osh_filters ()
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
function apply_communities ()
|
||||
{
|
||||
# Set community value based on dictionary of cidrs
|
||||
{{- $asnum := .Values.networking.bgp.asnumber }}
|
||||
{{- range .Values.networking.bgp.ipv6.community_cidr_ref }}
|
||||
{{- $community := .community }}
|
||||
{{- $cidr := .cidr }}
|
||||
{{- with .prefix }}
|
||||
if ( net ~ {{ $cidr }} ) then { bgp_community.add(({{ . }}, {{ $community }})); }
|
||||
{{- else }}
|
||||
if ( net ~ {{ $cidr }} ) then { bgp_community.add(({{ $asnum }}, {{ $community }})); }
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
filter calico_pools {
|
||||
apply_communities();
|
||||
calico_aggr();
|
||||
osh_filters();
|
||||
{{`{{range ls "/pool"}}{{$data := json (getv (printf "/pool/%s" .))}}`}}
|
||||
|
@ -8,7 +8,23 @@ function osh_filters ()
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
function apply_communities ()
|
||||
{
|
||||
# Set community value based on dictionary of cidrs
|
||||
{{- $asnum := .Values.networking.bgp.asnumber }}
|
||||
{{- range .Values.networking.bgp.ipv4.community_cidr_ref }}
|
||||
{{- $community := .community }}
|
||||
{{- $cidr := .cidr }}
|
||||
{{- with .prefix }}
|
||||
if ( net ~ {{ $cidr }} ) then { bgp_community.add(({{ . }}, {{ $community }})); }
|
||||
{{- else }}
|
||||
if ( net ~ {{ $cidr }} ) then { bgp_community.add(({{ $asnum }}, {{ $community }})); }
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
filter calico_pools {
|
||||
apply_communities();
|
||||
calico_aggr();
|
||||
osh_filters();
|
||||
{{`{{range ls "/v1/ipam/v4/pool"}}{{$data := json (getv (printf "/v1/ipam/v4/pool/%s" .))}}`}}
|
||||
|
@ -224,6 +224,21 @@ networking:
|
||||
# IPs within them on a host, we will announce the address in
|
||||
# addition to traditional pod workloads
|
||||
additional_cidrs: []
|
||||
# community_cidr_ref contains embedded objects that describe a
|
||||
# BGP community that is to be associated with the supplied CIDR.
|
||||
# The top-level key names are not important.
|
||||
#
|
||||
# The resulting BGP community will take the form of
|
||||
# <prefix>:<community>
|
||||
# If no prefix is specified then the asnumber is used
|
||||
community_cidr_ref:
|
||||
# cidr_community_description:
|
||||
# cidr: 192.168.0.0/16
|
||||
# community: 54321
|
||||
# prefix: 55555
|
||||
# alpha:
|
||||
# cidr: 10.0.0.0/16
|
||||
# community: 54322
|
||||
port:
|
||||
neighbor: 179
|
||||
listen: 179
|
||||
@ -247,6 +262,21 @@ networking:
|
||||
# IPs within them on a host, we will announce them in addition
|
||||
# to traditional pod workloads
|
||||
additional_cidrs: []
|
||||
# community_cidr_ref contains embedded objects that describe a
|
||||
# BGP community that is to be associated with the supplied CIDR.
|
||||
# The top-level key names are not important.
|
||||
#
|
||||
# The resulting BGP community will take the form of
|
||||
# <prefix>:<community>
|
||||
# If no prefix is specified then the asnumber is used
|
||||
community_cidr_ref:
|
||||
# cidr_community_description:
|
||||
# cidr: 2600:1:2:3::abcd/28
|
||||
# community: 54321
|
||||
# prefix: 55555
|
||||
# alpha:
|
||||
# cidr: 1400:a:2:3::abcd/26
|
||||
# community: 54322
|
||||
port:
|
||||
neighbor: 179
|
||||
listen: 179
|
||||
|
Loading…
x
Reference in New Issue
Block a user