Skip to content

Commit 65a503f

Browse files
committed
Add TrafficControl API
TrafficControl is a feature which allows mirroring or redirecting the traffic Pods send or receive. It enables users to monitor and analyze Pod traffic, and to enforce custom network protections for Pods with fine-grained control over network traffic. This patch adds types and CRD for TrafficControl API. Examples: 1. Mirror Pods (web=app) ingress traffic to a VXLAN tunnel ``` apiVersion: crd.antrea.io/v1alpha2 kind: TrafficControl metadata: name: mirror-web-app spec: appliedTo: podSelector: matchLabels: app: web direction: Ingress action: Mirror targetPort: name: vxlan0 type: VXLAN tunnelConfig: remoteIP: 1.1.1.1 ``` 2. Redirect Pods (web=app) traffic in both direction to OVS internal port firewall0 and expect the traffic to re-enter OVS via another OVS internal port firewall1 if they are not dropped. ``` apiVersion: crd.antrea.io/v1alpha2 kind: TrafficControl metadata: name: redirect spec: appliedTo: podSelector: matchLabels: role: web direction: Ingress action: Redirect targetPort: name: firewall0 type: Internal returnPort: name: firewall1 type: Internal ``` For antrea-io#3324 Signed-off-by: Quan Tian <[email protected]>
1 parent bd82ef6 commit 65a503f

File tree

19 files changed

+1958
-6
lines changed

19 files changed

+1958
-6
lines changed

build/yamls/antrea-aks.yml

+204
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,210 @@ spec:
20552055
subresources:
20562056
status: {}
20572057
---
2058+
apiVersion: apiextensions.k8s.io/v1
2059+
kind: CustomResourceDefinition
2060+
metadata:
2061+
labels:
2062+
app: antrea
2063+
name: trafficcontrols.crd.antrea.io
2064+
spec:
2065+
group: crd.antrea.io
2066+
names:
2067+
kind: TrafficControl
2068+
plural: trafficcontrols
2069+
shortNames:
2070+
- tc
2071+
singular: trafficcontrol
2072+
scope: Cluster
2073+
versions:
2074+
- additionalPrinterColumns:
2075+
- description: Specifies the direction of traffic that should be matched.
2076+
jsonPath: .spec.direction
2077+
name: Direction
2078+
type: string
2079+
- description: Specifies the action that should be taken for the traffic.
2080+
jsonPath: .spec.action
2081+
name: Action
2082+
type: string
2083+
- description: Specifies the port to which the traffic should be redirected or
2084+
mirrored.
2085+
jsonPath: .spec.targetPort.name
2086+
name: TargetPort
2087+
type: string
2088+
- description: Specifies the port from which the the traffic will be sent back
2089+
to OVS.
2090+
jsonPath: .spec.returnPort.name
2091+
name: ReturnPort
2092+
type: string
2093+
- jsonPath: .metadata.creationTimestamp
2094+
name: Age
2095+
type: date
2096+
name: v1alpha2
2097+
schema:
2098+
openAPIV3Schema:
2099+
properties:
2100+
spec:
2101+
properties:
2102+
action:
2103+
enum:
2104+
- Mirror
2105+
- Redirect
2106+
type: string
2107+
appliedTo:
2108+
properties:
2109+
namespaceSelector:
2110+
properties:
2111+
matchExpressions:
2112+
items:
2113+
properties:
2114+
key:
2115+
type: string
2116+
operator:
2117+
enum:
2118+
- In
2119+
- NotIn
2120+
- Exists
2121+
- DoesNotExist
2122+
type: string
2123+
values:
2124+
items:
2125+
pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$
2126+
type: string
2127+
type: array
2128+
type: object
2129+
type: array
2130+
matchLabels:
2131+
x-kubernetes-preserve-unknown-fields: true
2132+
type: object
2133+
podSelector:
2134+
properties:
2135+
matchExpressions:
2136+
items:
2137+
properties:
2138+
key:
2139+
type: string
2140+
operator:
2141+
enum:
2142+
- In
2143+
- NotIn
2144+
- Exists
2145+
- DoesNotExist
2146+
type: string
2147+
values:
2148+
items:
2149+
pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$
2150+
type: string
2151+
type: array
2152+
type: object
2153+
type: array
2154+
matchLabels:
2155+
x-kubernetes-preserve-unknown-fields: true
2156+
type: object
2157+
type: object
2158+
direction:
2159+
enum:
2160+
- Ingress
2161+
- Egress
2162+
- Both
2163+
type: string
2164+
returnPort:
2165+
properties:
2166+
name:
2167+
type: string
2168+
tunnelConfig:
2169+
properties:
2170+
remoteIP:
2171+
oneOf:
2172+
- format: ipv4
2173+
- format: ipv6
2174+
type: string
2175+
tunnelID:
2176+
type: integer
2177+
required:
2178+
- remoteIP
2179+
type: object
2180+
type:
2181+
enum:
2182+
- Internal
2183+
- Device
2184+
- VXLAN
2185+
- GENEVE
2186+
- GRE
2187+
type: string
2188+
required:
2189+
- name
2190+
- type
2191+
type: object
2192+
targetPort:
2193+
properties:
2194+
erspanConfig:
2195+
properties:
2196+
dir:
2197+
enum:
2198+
- 0
2199+
- 1
2200+
type: integer
2201+
hardwareID:
2202+
type: integer
2203+
index:
2204+
type: integer
2205+
remoteIP:
2206+
oneOf:
2207+
- format: ipv4
2208+
- format: ipv6
2209+
type: string
2210+
tunnelID:
2211+
type: integer
2212+
version:
2213+
enum:
2214+
- 1
2215+
- 2
2216+
type: integer
2217+
required:
2218+
- remoteIP
2219+
- version
2220+
type: object
2221+
name:
2222+
type: string
2223+
tunnelConfig:
2224+
properties:
2225+
remoteIP:
2226+
oneOf:
2227+
- format: ipv4
2228+
- format: ipv6
2229+
type: string
2230+
tunnelID:
2231+
type: integer
2232+
required:
2233+
- remoteIP
2234+
type: object
2235+
type:
2236+
enum:
2237+
- Internal
2238+
- Device
2239+
- VXLAN
2240+
- GENEVE
2241+
- GRE
2242+
- ERSPAN
2243+
type: string
2244+
required:
2245+
- name
2246+
- type
2247+
type: object
2248+
required:
2249+
- appliedTo
2250+
- direction
2251+
- action
2252+
- targetPort
2253+
type: object
2254+
required:
2255+
- spec
2256+
type: object
2257+
served: true
2258+
storage: true
2259+
subresources:
2260+
status: {}
2261+
---
20582262
apiVersion: v1
20592263
kind: ServiceAccount
20602264
metadata:

0 commit comments

Comments
 (0)