Skip to content

Commit 623ab01

Browse files
authored
vpc: add support for dedicated BFD LRP (#4717)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent bf9bea1 commit 623ab01

17 files changed

+846
-29
lines changed

charts/kube-ovn/templates/kube-ovn-crd.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,51 @@ spec:
16651665
type: string
16661666
type: object
16671667
type: array
1668+
bfdPort:
1669+
properties:
1670+
enabled:
1671+
type: boolean
1672+
default: false
1673+
ip:
1674+
type: string
1675+
anyOf:
1676+
- pattern: ^$
1677+
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
1678+
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
1679+
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5]),((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
1680+
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:))),(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
1681+
nodeSelector:
1682+
properties:
1683+
matchExpressions:
1684+
items:
1685+
properties:
1686+
key:
1687+
type: string
1688+
operator:
1689+
type: string
1690+
enum:
1691+
- In
1692+
- NotIn
1693+
- Exists
1694+
- DoesNotExist
1695+
values:
1696+
items:
1697+
type: string
1698+
type: array
1699+
required:
1700+
- key
1701+
- operator
1702+
type: object
1703+
type: array
1704+
matchLabels:
1705+
additionalProperties:
1706+
type: string
1707+
type: object
1708+
type: object
1709+
type: object
1710+
x-kubernetes-validations:
1711+
- rule: "self.enabled == false || self.ip != ''"
1712+
message: 'Port IP must be set when BFD Port is enabled'
16681713
type: object
16691714
status:
16701715
properties:
@@ -1721,6 +1766,20 @@ spec:
17211766
type: string
17221767
sctpSessionLoadBalancer:
17231768
type: string
1769+
bfdPort:
1770+
type: object
1771+
properties:
1772+
enabled:
1773+
type: boolean
1774+
default: false
1775+
ip:
1776+
type: string
1777+
name:
1778+
type: string
1779+
nodes:
1780+
type: array
1781+
items:
1782+
type: string
17241783
type: object
17251784
type: object
17261785
served: true

dist/images/Dockerfile.base

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ RUN cd /usr/src/ && git clone -b branch-24.03 --depth=1 https://github.com/ovn-o
6161
# northd: skip arp/nd request for lrp addresses from localnet ports
6262
curl -s https://github.com/kubeovn/ovn/commit/283930b627ffa843ebf0e7c3fa0cc70edacfdd12.patch | git apply && \
6363
# ovn-controller: make activation strategy work for single chassis
64-
curl -s https://github.com/kubeovn/ovn/commit/1160d956e49e8f3f1b19535dbf1b9a624a090717.patch | git apply
64+
curl -s https://github.com/kubeovn/ovn/commit/1160d956e49e8f3f1b19535dbf1b9a624a090717.patch | git apply && \
65+
# support dedicated BFD LRP
66+
curl -s https://github.com/kubeovn/ovn/commit/40345aa35d03c93cde877ccfa8111346291ebc7c.patch | git apply
6567

6668
RUN apt install -y build-essential fakeroot \
6769
autoconf automake bzip2 debhelper-compat dh-exec dh-python dh-sequence-python3 dh-sequence-sphinxdoc \
@@ -89,10 +91,12 @@ RUN mkdir -p /usr/src/openbfdd && \
8991
tar -xz -C /usr/src/openbfdd --strip-components=1
9092

9193
ADD OpenBFDD-compile.patch /usr/src/
94+
ADD OpenBFDD-allow-ttl-254.patch /usr/src/
9295

9396
RUN cd /usr/src/openbfdd && \
9497
rm -vf missing && \
9598
git apply --no-apply /usr/src/OpenBFDD-compile.patch && \
99+
git apply --no-apply /usr/src/OpenBFDD-allow-ttl-254.patch && \
96100
autoupdate && \
97101
./autogen.sh && \
98102
./configure --enable-silent-rules && \
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From edc60ecd05185acf317ac3ca67c54eb50f9e99a8 Mon Sep 17 00:00:00 2001
2+
From: zhangzujian <zhangzujian.7@gmail.com>
3+
Date: Thu, 31 Oct 2024 02:56:09 +0000
4+
Subject: [PATCH] allow ttl 254
5+
6+
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
7+
---
8+
Beacon.cpp | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/Beacon.cpp b/Beacon.cpp
12+
index d1b0658..1d4c3da 100755
13+
--- a/Beacon.cpp
14+
+++ b/Beacon.cpp
15+
@@ -481,7 +481,7 @@ void Beacon::handleListenSocket(Socket &socket)
16+
}
17+
18+
// TTL assumes that all control packets are from neighbors.
19+
- if (ttl != 255)
20+
+ if (ttl < 254)
21+
{
22+
gLog.Optional(Log::Discard, "Discard packet: bad ttl/hops %hhu", ttl);
23+
return;
24+
--
25+
2.43.0
26+

dist/images/install.sh

+59
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,51 @@ spec:
19121912
type: string
19131913
type: object
19141914
type: array
1915+
bfdPort:
1916+
properties:
1917+
enabled:
1918+
type: boolean
1919+
default: false
1920+
ip:
1921+
type: string
1922+
anyOf:
1923+
- pattern: ^$
1924+
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
1925+
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
1926+
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5]),((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
1927+
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:))),(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
1928+
nodeSelector:
1929+
properties:
1930+
matchExpressions:
1931+
items:
1932+
properties:
1933+
key:
1934+
type: string
1935+
operator:
1936+
type: string
1937+
enum:
1938+
- In
1939+
- NotIn
1940+
- Exists
1941+
- DoesNotExist
1942+
values:
1943+
items:
1944+
type: string
1945+
type: array
1946+
required:
1947+
- key
1948+
- operator
1949+
type: object
1950+
type: array
1951+
matchLabels:
1952+
additionalProperties:
1953+
type: string
1954+
type: object
1955+
type: object
1956+
type: object
1957+
x-kubernetes-validations:
1958+
- rule: "self.enabled == false || self.ip != ''"
1959+
message: 'Port IP must be set when BFD Port is enabled'
19151960
type: object
19161961
status:
19171962
properties:
@@ -1968,6 +2013,20 @@ spec:
19682013
type: string
19692014
sctpSessionLoadBalancer:
19702015
type: string
2016+
bfdPort:
2017+
type: object
2018+
properties:
2019+
enabled:
2020+
type: boolean
2021+
default: false
2022+
ip:
2023+
type: string
2024+
name:
2025+
type: string
2026+
nodes:
2027+
type: array
2028+
items:
2029+
type: string
19712030
type: object
19722031
type: object
19732032
served: true

dist/images/kubectl-ko

+2-2
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ trace(){
420420
case $type in
421421
icmp)
422422
set -x
423-
kubectl exec "$OVN_SB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-trace "$ls" "inport == \"$lsp\" && ip.ttl == 64 && icmp && eth.src == $mac && ip$af.src == $srcIP && eth.dst == $dstMac && ip$af.dst == $dst && ct.new"
423+
kubectl exec "$OVN_SB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-trace "$ls" "inport == \"$lsp\" && ip.ttl == 255 && icmp && eth.src == $mac && ip$af.src == $srcIP && eth.dst == $dstMac && ip$af.dst == $dst && ct.new"
424424
;;
425425
tcp|udp)
426426
set -x
427-
kubectl exec "$OVN_SB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-trace "$ls" "inport == \"$lsp\" && ip.ttl == 64 && eth.src == $mac && ip$af.src == $srcIP && eth.dst == $dstMac && ip$af.dst == $dst && $type.src == 10000 && $type.dst == $4 && ct.new"
427+
kubectl exec "$OVN_SB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-trace "$ls" "inport == \"$lsp\" && ip.ttl == 255 && eth.src == $mac && ip$af.src == $srcIP && eth.dst == $dstMac && ip$af.dst == $dst && $type.src == 10000 && $type.dst == $4 && ct.new"
428428
;;
429429
arp)
430430
case "$4" in

0 commit comments

Comments
 (0)