Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TrafficControl API #3644

Merged
merged 1 commit into from Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/charts/antrea/conf/antrea-agent.conf
Expand Up @@ -47,6 +47,9 @@ featureGates:
# Enable managing external IPs of Services of LoadBalancer type.
{{- include "featureGate" (dict "featureGates" .Values.featureGates "name" "ServiceExternalIP" "default" false) }}

# Enable mirroring or redirecting the traffic Pods send or receive.
{{- include "featureGate" (dict "featureGates" .Values.featureGates "name" "TrafficControl" "default" false) }}

# Name of the OpenVSwitch bridge antrea-agent will create and use.
# Make sure it doesn't conflict with your existing OpenVSwitch bridges.
ovsBridge: {{ .Values.ovs.bridgeName | quote }}
Expand Down
1 change: 1 addition & 0 deletions build/charts/antrea/templates/agent/clusterrole.yaml
Expand Up @@ -167,6 +167,7 @@ rules:
resources:
- externalippools
- ippools
- trafficcontrols
verbs:
- get
- watch
Expand Down
283 changes: 283 additions & 0 deletions build/charts/antrea/templates/crds/trafficcontrol.yaml
@@ -0,0 +1,283 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: trafficcontrols.crd.antrea.io
spec:
group: crd.antrea.io
versions:
- name: v1alpha2
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required:
- spec
properties:
spec:
type: object
required:
- appliedTo
- direction
- action
- targetPort
properties:
appliedTo:
type: object
properties:
podSelector:
type: object
properties:
matchExpressions:
type: array
items:
type: object
properties:
key:
type: string
operator:
enum:
- In
- NotIn
- Exists
- DoesNotExist
type: string
values:
type: array
items:
type: string
pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$"
matchLabels:
x-kubernetes-preserve-unknown-fields: true
namespaceSelector:
type: object
properties:
matchExpressions:
type: array
items:
type: object
properties:
key:
type: string
operator:
enum:
- In
- NotIn
- Exists
- DoesNotExist
type: string
values:
type: array
items:
type: string
pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$"
matchLabels:
x-kubernetes-preserve-unknown-fields: true
direction:
type: string
enum:
- Ingress
- Egress
- Both
action:
type: string
enum:
- Mirror
- Redirect
targetPort:
type: object
oneOf:
- required: [ovsInternal]
- required: [device]
- required: [geneve]
- required: [vxlan]
- required: [gre]
- required: [erspan]
properties:
ovsInternal:
type: object
required:
- name
properties:
name:
type: string
device:
type: object
required:
- name
properties:
name:
type: string
geneve:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
vni:
type: integer
minimum: 0
maximum: 16777215
destinationPort:
type: integer
minimum: 1
maximum: 65535
vxlan:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
vni:
type: integer
minimum: 0
maximum: 16777215
destinationPort:
type: integer
minimum: 1
maximum: 65535
gre:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
key:
type: integer
minimum: 0
maximum: 4294967295
erspan:
type: object
required:
- remoteIP
- version
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
sessionID:
type: integer
minimum: 0
maximum: 1023
version:
type: integer
enum:
- 1
- 2
index:
type: integer
dir:
type: integer
enum:
- 0
- 1
hardwareID:
type: integer
returnPort:
type: object
oneOf:
- required: [ovsInternal]
- required: [device]
- required: [geneve]
- required: [vxlan]
- required: [gre]
properties:
ovsInternal:
type: object
required:
- name
properties:
name:
type: string
device:
type: object
required:
- name
properties:
name:
type: string
geneve:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
vni:
type: integer
minimum: 0
maximum: 16777215
destinationPort:
type: integer
minimum: 1
maximum: 65535
vxlan:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
vni:
type: integer
minimum: 0
maximum: 16777215
destinationPort:
type: integer
minimum: 1
maximum: 65535
gre:
type: object
required:
- remoteIP
properties:
remoteIP:
type: string
oneOf:
- format: ipv4
- format: ipv6
key:
type: integer
minimum: 0
maximum: 4294967295
additionalPrinterColumns:
- description: Specifies the direction of traffic that should be matched.
jsonPath: .spec.direction
name: Direction
type: string
- description: Specifies the action that should be taken for the traffic.
jsonPath: .spec.action
name: Action
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
subresources:
status: {}
scope: Cluster
names:
plural: trafficcontrols
singular: trafficcontrol
kind: TrafficControl
shortNames:
- tc