Skip to content

Commit

Permalink
Add source ports in policy API
Browse files Browse the repository at this point in the history
This commit  adds two optional fields, namely 'sourcePort' and
'sourceEndPort' to the NetworkPolicyPort definition of Antrea-native
policies.
When specified, the policy rule will only match traffic initiated
from a specific port (if only sourcePort is provided) or from a
specific port range (if both sourcePort and sourceEndPort are
provided). Supported protocols are TCP, UDP and SCTP.

Signed-off-by: Dyanngg <dingyang@vmware.com>
  • Loading branch information
Dyanngg committed May 15, 2023
1 parent 7866681 commit 0a8126f
Show file tree
Hide file tree
Showing 33 changed files with 889 additions and 281 deletions.
8 changes: 8 additions & 0 deletions build/charts/antrea/crds/clusternetworkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -472,6 +476,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
8 changes: 8 additions & 0 deletions build/charts/antrea/crds/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -381,6 +385,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -850,6 +854,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1713,6 +1721,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1932,6 +1944,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea-crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -843,6 +847,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1694,6 +1702,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1913,6 +1925,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -850,6 +854,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1713,6 +1721,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1932,6 +1944,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -850,6 +854,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1713,6 +1721,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1932,6 +1944,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -850,6 +854,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1713,6 +1721,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1932,6 +1944,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -850,6 +854,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1713,6 +1721,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down Expand Up @@ -1932,6 +1944,10 @@ spec:
x-kubernetes-int-or-string: true
endPort:
type: integer
sourcePort:
type: integer
sourceEndPort:
type: integer
protocols:
type: array
items:
Expand Down
Loading

0 comments on commit 0a8126f

Please sign in to comment.