Skip to content

Commit f0b7bb4

Browse files
authored
Add CRD to configure FlowExporter targets dynamically (#7494)
For #7231 We add a new CRD, `FlowExporterTarget` which can be used to configure a target / sink / collector for the FlowExporter dynamically. There are 2 main advantages. First, the ability to configure multiple targets if desired, each with its own properties. Second, the ability to enable / disabled flow export dynamically, without requiring a ConfigMap update and an antrea-agent rollout. Signed-off-by: Andrew Su <[email protected]>
1 parent 7bd5d51 commit f0b7bb4

File tree

21 files changed

+1350
-3
lines changed

21 files changed

+1350
-3
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: flowexporterdestinations.crd.antrea.io
5+
labels:
6+
app: antrea
7+
spec:
8+
group: crd.antrea.io
9+
versions:
10+
- name: v1alpha1
11+
served: true
12+
storage: true
13+
additionalPrinterColumns:
14+
- name: Address:Port
15+
type: string
16+
description: Address of flow collector.
17+
jsonPath: .spec.address
18+
schema:
19+
openAPIV3Schema:
20+
type: object
21+
required:
22+
- spec
23+
properties:
24+
spec:
25+
type: object
26+
required:
27+
- address
28+
- protocol
29+
properties:
30+
address:
31+
type: string
32+
description: >
33+
The flow collector address including port as a string.
34+
35+
Example:
36+
- flow-aggregator/flow-aggregator:14739
37+
- 10.244.10.10:4739
38+
pattern: ^.+:[0-9]+$
39+
protocol:
40+
type: object
41+
description: >
42+
The protocol used to send flow details.
43+
44+
Exactly one must be defined and non-nil.
45+
oneOf:
46+
- required: [ipfix]
47+
- required: [grpc]
48+
properties:
49+
ipfix:
50+
type: object
51+
description: Configuration for using IPFIX protocol.
52+
required:
53+
- transport
54+
properties:
55+
transport:
56+
type: string
57+
enum:
58+
- tcp
59+
- udp
60+
- tls
61+
grpc:
62+
type: object
63+
description: Configuration for using gRPC protocol.
64+
filter:
65+
type: object
66+
properties:
67+
protocols:
68+
type: array
69+
description: >
70+
Filter for only flows whose protocol which match this filter.
71+
The default is accept all protocols if unset or nil.
72+
73+
Supported values are [tcp, udp, sctp].
74+
items:
75+
type: string
76+
enum:
77+
- tcp
78+
- udp
79+
- sctp
80+
activeFlowExportTimeoutSeconds:
81+
type: integer
82+
format: int32
83+
description: >
84+
Provide the active flow export timeout in seconds, which is the timeout after which a flow
85+
record is sent to the collector for active flows. Thus, for flows with a continuous
86+
stream of packets, a flow record will be exported to the collector once the elapsed
87+
time since the last export event is equal to the value of this timeout.
88+
minimum: 1
89+
default: 5
90+
idleFlowExportTimeoutSeconds:
91+
type: integer
92+
format: int32
93+
description: >
94+
Provide the idle flow export timeout in seconds, which is the timeout after which a flow
95+
record is sent to the collector for idle flows. A flow is considered idle if no
96+
packet matching this flow has been observed since the last export event.
97+
minimum: 1
98+
default: 15
99+
scope: Cluster
100+
names:
101+
plural: flowexporterdestinations
102+
singular: flowexporterdestination
103+
kind: FlowExporterDestination
104+
shortNames:
105+
- flowexporterdest

build/charts/antrea/templates/agent/clusterrole.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ rules:
218218
- ippools/status
219219
verbs:
220220
- update
221+
- apiGroups:
222+
- crd.antrea.io
223+
resources:
224+
- flowexporterdestinations
225+
verbs:
226+
- get
227+
- watch
228+
- list
221229
- apiGroups:
222230
- k8s.cni.cncf.io
223231
resources:

build/yamls/antrea-aks.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,114 @@ spec:
17951795
shortNames:
17961796
- en
17971797

1798+
---
1799+
# Source: antrea/crds/flowexporterdestination.yaml
1800+
apiVersion: apiextensions.k8s.io/v1
1801+
kind: CustomResourceDefinition
1802+
metadata:
1803+
name: flowexporterdestinations.crd.antrea.io
1804+
labels:
1805+
app: antrea
1806+
spec:
1807+
group: crd.antrea.io
1808+
versions:
1809+
- name: v1alpha1
1810+
served: true
1811+
storage: true
1812+
additionalPrinterColumns:
1813+
- name: Address:Port
1814+
type: string
1815+
description: Address of flow collector.
1816+
jsonPath: .spec.address
1817+
schema:
1818+
openAPIV3Schema:
1819+
type: object
1820+
required:
1821+
- spec
1822+
properties:
1823+
spec:
1824+
type: object
1825+
required:
1826+
- address
1827+
- protocol
1828+
properties:
1829+
address:
1830+
type: string
1831+
description: >
1832+
The flow collector address including port as a string.
1833+
1834+
Example:
1835+
- flow-aggregator/flow-aggregator:14739
1836+
- 10.244.10.10:4739
1837+
pattern: ^.+:[0-9]+$
1838+
protocol:
1839+
type: object
1840+
description: >
1841+
The protocol used to send flow details.
1842+
1843+
Exactly one must be defined and non-nil.
1844+
oneOf:
1845+
- required: [ipfix]
1846+
- required: [grpc]
1847+
properties:
1848+
ipfix:
1849+
type: object
1850+
description: Configuration for using IPFIX protocol.
1851+
required:
1852+
- transport
1853+
properties:
1854+
transport:
1855+
type: string
1856+
enum:
1857+
- tcp
1858+
- udp
1859+
- tls
1860+
grpc:
1861+
type: object
1862+
description: Configuration for using gRPC protocol.
1863+
filter:
1864+
type: object
1865+
properties:
1866+
protocols:
1867+
type: array
1868+
description: >
1869+
Filter for only flows whose protocol which match this filter.
1870+
The default is accept all protocols if unset or nil.
1871+
1872+
Supported values are [tcp, udp, sctp].
1873+
items:
1874+
type: string
1875+
enum:
1876+
- tcp
1877+
- udp
1878+
- sctp
1879+
activeFlowExportTimeoutSeconds:
1880+
type: integer
1881+
format: int32
1882+
description: >
1883+
Provide the active flow export timeout in seconds, which is the timeout after which a flow
1884+
record is sent to the collector for active flows. Thus, for flows with a continuous
1885+
stream of packets, a flow record will be exported to the collector once the elapsed
1886+
time since the last export event is equal to the value of this timeout.
1887+
minimum: 1
1888+
default: 5
1889+
idleFlowExportTimeoutSeconds:
1890+
type: integer
1891+
format: int32
1892+
description: >
1893+
Provide the idle flow export timeout in seconds, which is the timeout after which a flow
1894+
record is sent to the collector for idle flows. A flow is considered idle if no
1895+
packet matching this flow has been observed since the last export event.
1896+
minimum: 1
1897+
default: 15
1898+
scope: Cluster
1899+
names:
1900+
plural: flowexporterdestinations
1901+
singular: flowexporterdestination
1902+
kind: FlowExporterDestination
1903+
shortNames:
1904+
- flowexporterdest
1905+
17981906
---
17991907
# Source: antrea/crds/group.yaml
18001908
apiVersion: apiextensions.k8s.io/v1
@@ -4840,6 +4948,14 @@ rules:
48404948
- ippools/status
48414949
verbs:
48424950
- update
4951+
- apiGroups:
4952+
- crd.antrea.io
4953+
resources:
4954+
- flowexporterdestinations
4955+
verbs:
4956+
- get
4957+
- watch
4958+
- list
48434959
- apiGroups:
48444960
- k8s.cni.cncf.io
48454961
resources:

build/yamls/antrea-crds.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,112 @@ spec:
17761776
---
17771777
apiVersion: apiextensions.k8s.io/v1
17781778
kind: CustomResourceDefinition
1779+
metadata:
1780+
name: flowexporterdestinations.crd.antrea.io
1781+
labels:
1782+
app: antrea
1783+
spec:
1784+
group: crd.antrea.io
1785+
versions:
1786+
- name: v1alpha1
1787+
served: true
1788+
storage: true
1789+
additionalPrinterColumns:
1790+
- name: Address:Port
1791+
type: string
1792+
description: Address of flow collector.
1793+
jsonPath: .spec.address
1794+
schema:
1795+
openAPIV3Schema:
1796+
type: object
1797+
required:
1798+
- spec
1799+
properties:
1800+
spec:
1801+
type: object
1802+
required:
1803+
- address
1804+
- protocol
1805+
properties:
1806+
address:
1807+
type: string
1808+
description: >
1809+
The flow collector address including port as a string.
1810+
1811+
Example:
1812+
- flow-aggregator/flow-aggregator:14739
1813+
- 10.244.10.10:4739
1814+
pattern: ^.+:[0-9]+$
1815+
protocol:
1816+
type: object
1817+
description: >
1818+
The protocol used to send flow details.
1819+
1820+
Exactly one must be defined and non-nil.
1821+
oneOf:
1822+
- required: [ipfix]
1823+
- required: [grpc]
1824+
properties:
1825+
ipfix:
1826+
type: object
1827+
description: Configuration for using IPFIX protocol.
1828+
required:
1829+
- transport
1830+
properties:
1831+
transport:
1832+
type: string
1833+
enum:
1834+
- tcp
1835+
- udp
1836+
- tls
1837+
grpc:
1838+
type: object
1839+
description: Configuration for using gRPC protocol.
1840+
filter:
1841+
type: object
1842+
properties:
1843+
protocols:
1844+
type: array
1845+
description: >
1846+
Filter for only flows whose protocol which match this filter.
1847+
The default is accept all protocols if unset or nil.
1848+
1849+
Supported values are [tcp, udp, sctp].
1850+
items:
1851+
type: string
1852+
enum:
1853+
- tcp
1854+
- udp
1855+
- sctp
1856+
activeFlowExportTimeoutSeconds:
1857+
type: integer
1858+
format: int32
1859+
description: >
1860+
Provide the active flow export timeout in seconds, which is the timeout after which a flow
1861+
record is sent to the collector for active flows. Thus, for flows with a continuous
1862+
stream of packets, a flow record will be exported to the collector once the elapsed
1863+
time since the last export event is equal to the value of this timeout.
1864+
minimum: 1
1865+
default: 5
1866+
idleFlowExportTimeoutSeconds:
1867+
type: integer
1868+
format: int32
1869+
description: >
1870+
Provide the idle flow export timeout in seconds, which is the timeout after which a flow
1871+
record is sent to the collector for idle flows. A flow is considered idle if no
1872+
packet matching this flow has been observed since the last export event.
1873+
minimum: 1
1874+
default: 15
1875+
scope: Cluster
1876+
names:
1877+
plural: flowexporterdestinations
1878+
singular: flowexporterdestination
1879+
kind: FlowExporterDestination
1880+
shortNames:
1881+
- flowexporterdest
1882+
---
1883+
apiVersion: apiextensions.k8s.io/v1
1884+
kind: CustomResourceDefinition
17791885
metadata:
17801886
name: groups.crd.antrea.io
17811887
spec:

0 commit comments

Comments
 (0)