Skip to content

Commit 3b487cb

Browse files
committed
felix programs ipip tunnel routes
1 parent 4759eb3 commit 3b487cb

File tree

165 files changed

+7238
-1350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+7238
-1350
lines changed

charts/calico/templates/calico-config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ data:
4141
# Configure the backend to use.
4242
{{- if or (.Values.flannel_migration) (.Values.vxlan) }}
4343
calico_backend: "vxlan"
44+
{{- else if (.Values.ipip) }}
45+
calico_backend: "ipip"
4446
{{- else }}
4547
calico_backend: "bird"
4648
{{- end }}

charts/calico/templates/calico-node.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ spec:
406406
command:
407407
- /bin/calico-node
408408
- -felix-live
409-
{{- if and (eq .Values.network "calico") (not .Values.flannel_migration) (not .Values.vxlan) }}
409+
{{- if and (eq .Values.network "calico") (not .Values.flannel_migration) (not .Values.vxlan) (not .Values.ipip) }}
410410
- -bird-live
411411
{{- end }}
412412
periodSeconds: 10
@@ -419,7 +419,7 @@ spec:
419419
command:
420420
- /bin/calico-node
421421
- -felix-ready
422-
{{- if and (not .Values.flannel_migration) (not .Values.vxlan) }}
422+
{{- if and (not .Values.flannel_migration) (not .Values.vxlan) (not .Values.ipip) }}
423423
- -bird-ready
424424
{{- end }}
425425
{{- else if eq .Values.network "flannel" }}

charts/values/calico-ipip.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
datastore: kubernetes
2+
network: calico
3+
ipip: true

confd/etc/calico/confd/templates/bird6_ipam.cfg.template

+5-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ function reject_disabled_pools ()
1010

1111
function reject_tunnel_routes () {
1212
# Don't export tunnel routes to other nodes, Felix programs them.
13-
# IPIP routes are handled by Bird, and it does not re-advertise them.
1413
if (defined(ifname)) then {
15-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
16-
reject;
17-
}
14+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
15+
reject;
16+
}
1817
}
1918
}
2019

@@ -66,19 +65,17 @@ function calico_export_to_bgp_peers(bool internal_peer) {
6665
filter calico_kernel_programming {
6766
{{- $reject_key := "/rejectcidrsv6"}}
6867
{{- if ls $reject_key}}
69-
7068
# Don't program static routes into kernel.
7169
{{- range ls $reject_key}}
7270
{{- $parts := split . "-"}}
7371
{{- $cidr := join $parts "/"}}
7472
if ( net ~ {{$cidr}} ) then { reject; }
7573
{{- end}}
76-
7774
{{- end}}
7875
{{range ls "/v1/ipam/v6/pool"}}{{$data := json (getv (printf "/v1/ipam/v6/pool/%s" .))}}
79-
{{- if $data.vxlan_mode}}
76+
{{- if or ($data.vxlan_mode) ($data.ipip_mode)}}
8077
if ( net ~ {{$data.cidr}} ) then {
81-
# Don't program VXLAN routes into the kernel - these are handled by Felix.
78+
# Don't program VXLAN or IPIP routes into the kernel - these are handled by Felix.
8279
reject;
8380
}
8481
{{- end}}{{/* End of '$data.vxlan_mode' */}}

confd/etc/calico/confd/templates/bird_ipam.cfg.template

+7-24
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ function reject_disabled_pools ()
1010

1111
function reject_tunnel_routes () {
1212
# Don't export tunnel routes to other nodes, Felix programs them.
13-
# IPIP routes are handled by Bird, and it does not re-advertise them.
1413
if (defined(ifname)) then {
15-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
16-
reject;
17-
}
14+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
15+
reject;
16+
}
1817
}
1918
}
2019

@@ -67,36 +66,20 @@ function calico_export_to_bgp_peers(bool internal_peer) {
6766
filter calico_kernel_programming {
6867
{{- $reject_key := "/rejectcidrs"}}
6968
{{- if ls $reject_key}}
70-
7169
# Don't program static routes into kernel.
7270
{{- range ls $reject_key}}
7371
{{- $parts := split . "-"}}
7472
{{- $cidr := join $parts "/"}}
7573
if ( net ~ {{$cidr}} ) then { reject; }
7674
{{- end}}
77-
7875
{{- end}}
79-
{{- if exists $network_key}}{{$network := getv $network_key}}
8076
{{range ls "/v1/ipam/v4/pool"}}{{$data := json (getv (printf "/v1/ipam/v4/pool/%s" .))}}
77+
{{- if or ($data.vxlan_mode) ($data.ipip_mode)}}
8178
if ( net ~ {{$data.cidr}} ) then {
82-
{{- if $data.vxlan_mode}}
83-
# Don't program VXLAN routes into the kernel - these are handled by Felix.
79+
# Don't program VXLAN or IPIP routes into the kernel - these are handled by Felix.
8480
reject;
8581
}
86-
{{- else if $data.ipip_mode}}{{if eq $data.ipip_mode "cross-subnet"}}
87-
if defined(bgp_next_hop) && ( bgp_next_hop ~ {{$network}} ) then
88-
krt_tunnel = ""; {{- /* Destination in ipPool, mode is cross sub-net, route from-host on subnet, do not use IPIP */}}
89-
else
90-
krt_tunnel = "{{$data.ipip}}"; {{- /* Destination in ipPool, mode is cross sub-net, route from-host off subnet, set the tunnel (if IPIP not enabled, value will be "") */}}
91-
accept;
92-
} {{- else}}
93-
krt_tunnel = "{{$data.ipip}}"; {{- /* Destination in ipPool, mode not cross sub-net, set the tunnel (if IPIP not enabled, value will be "") */}}
94-
accept;
95-
} {{- end}} {{- else}}
96-
krt_tunnel = "{{$data.ipip}}"; {{- /* Destination in ipPool, mode field is not present, set the tunnel (if IPIP not enabled, value will be "") */}}
97-
accept;
98-
} {{- end}}
99-
{{end}}
100-
{{- end}}{{/* End of 'exists $network_key' */}}
82+
{{- end}}{{/* End of '$data.vxlan_mode' */}}
83+
{{- end}}{{/* End of 'range ls...' */}}
10184
accept; {{- /* Destination is not in any ipPool, accept */}}
10285
}

confd/tests/compiled_templates/bgpfilter/export_only/explicit_peer/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/export_only/explicit_peer/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/export_only/global_peer/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/export_only/global_peer/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_deletion/step1/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_deletion/step1/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_deletion/step2/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_deletion/step2/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_names/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/filter_names/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/import_only/explicit_peer/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/import_only/explicit_peer/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/import_only/global_peer/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/import_only/global_peer/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/match_interface/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/match_interface/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/match_operators/bird6_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

confd/tests/compiled_templates/bgpfilter/match_operators/bird_ipam.cfg

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ function reject_disabled_pools ()
66

77
function reject_tunnel_routes () {
88
# Don't export tunnel routes to other nodes, Felix programs them.
9-
# IPIP routes are handled by Bird, and it does not re-advertise them.
109
if (defined(ifname)) then {
11-
if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
12-
reject;
13-
}
10+
if ((ifname ~ "*.cali") || (ifname ~ "*.calico") || (ifname ~ "tunl0")) then {
11+
reject;
12+
}
1413
}
1514
}
1615

0 commit comments

Comments
 (0)