Skip to content

Commit 3dba4bd

Browse files
paulyeo21Kwangu Paul Yeo
andauthored
EKS multiple listener support (#630)
* EKS multiple listener support * Add support for TCPRouteMatch and GRPCRouteMatch * Update unit test Co-authored-by: Kwangu Paul Yeo <[email protected]>
1 parent 762ce41 commit 3dba4bd

14 files changed

+1229
-400
lines changed

apis/appmesh/v1beta2/gatewayroute_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ type GatewayRouteVirtualService struct {
3535
type GatewayRouteTarget struct {
3636
// The virtual service to associate with the gateway route target.
3737
VirtualService GatewayRouteVirtualService `json:"virtualService"`
38+
// Specifies the port of the gateway route target
39+
// +kubebuilder:validation:Minimum=0
40+
// +optional
41+
Port *int64 `json:"port,omitempty"`
3842
}
3943

4044
// GRPCGatewayRouteMatch refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_GrpcGatewayRouteMatch.html
@@ -51,6 +55,10 @@ type GRPCGatewayRouteMatch struct {
5155
// +kubebuilder:validation:MaxItems=10
5256
// +optional
5357
Metadata []GRPCGatewayRouteMetadata `json:"metadata,omitempty"`
58+
// Specifies the port the request to be matched on
59+
// +kubebuilder:validation:Minimum=0
60+
// +optional
61+
Port *int64 `json:"port,omitempty"`
5462
}
5563

5664
// GRPCGatewayRouteMetadata refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_GrpcGatewayRouteMetadata.html
@@ -114,6 +122,10 @@ type HTTPGatewayRouteMatch struct {
114122
// +kubebuilder:validation:MaxItems=10
115123
// +optional
116124
Headers []HTTPGatewayRouteHeader `json:"headers,omitempty"`
125+
// Specifies the port the request to be matched on
126+
// +kubebuilder:validation:Minimum=0
127+
// +optional
128+
Port *int64 `json:"port,omitempty"`
117129
}
118130

119131
// HTTPGatewayRouteHeader refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_HttpGatewayRouteHeader.html

apis/appmesh/v1beta2/virtualgateway_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ type VirtualGatewaySpec struct {
331331
GatewayRouteSelector *metav1.LabelSelector `json:"gatewayRouteSelector,omitempty"`
332332
// The listener that the virtual gateway is expected to receive inbound traffic from
333333
// +kubebuilder:validation:MinItems=0
334-
// +kubebuilder:validation:MaxItems=1
335334
Listeners []VirtualGatewayListener `json:"listeners,omitempty"`
336335
// The inbound and outbound access logging information for the virtual gateway.
337336
// +optional

apis/appmesh/v1beta2/virtualnode_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ type VirtualNodeSpec struct {
429429
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
430430
// The listener that the virtual node is expected to receive inbound traffic from
431431
// +kubebuilder:validation:MinItems=0
432-
// +kubebuilder:validation:MaxItems=1
433432
// +optional
434433
Listeners []Listener `json:"listeners,omitempty"`
435434
// The service discovery information for the virtual node. Optional if there is no

apis/appmesh/v1beta2/virtualrouter_types.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type WeightedTarget struct {
3939
// +kubebuilder:validation:Minimum=0
4040
// +kubebuilder:validation:Maximum=100
4141
Weight int64 `json:"weight"`
42+
// Specifies the targeted port of the weighted object
43+
// +kubebuilder:validation:Minimum=0
44+
// +optional
45+
Port *int64 `json:"port,omitempty"`
4246
}
4347

4448
// HTTPRouteHeader refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_HttpRouteHeader.html
@@ -81,6 +85,10 @@ type HTTPRouteMatch struct {
8185
// +kubebuilder:validation:MaxItems=10
8286
// +optional
8387
QueryParameters []HTTPQueryParameters `json:"queryParameters,omitempty"`
88+
// Specifies the port to match requests with
89+
// +kubebuilder:validation:Minimum=0
90+
// +optional
91+
Port *int64 `json:"port,omitempty"`
8492
}
8593

8694
// HTTPRouteAction refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_HttpRouteAction.html
@@ -141,13 +149,23 @@ type TCPRouteAction struct {
141149

142150
// TCPRoute refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_TcpRoute.html
143151
type TCPRoute struct {
152+
// An object that represents the criteria for determining a request match.
153+
Match TCPRouteMatch `json:"match"`
144154
// The action to take if a match is determined.
145155
Action TCPRouteAction `json:"action"`
146156
// An object that represents a tcp timeout.
147157
// +optional
148158
Timeout *TCPTimeout `json:"timeout,omitempty"`
149159
}
150160

161+
// TCPRouteMatch refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_TcpRouteMatch.html
162+
type TCPRouteMatch struct {
163+
// Specifies the port to match requests with
164+
// +kubebuilder:validation:Minimum=0
165+
// +optional
166+
Port *int64 `json:"port,omitempty"`
167+
}
168+
151169
// GRPCRouteMetadata refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_GrpcRouteMetadata.html
152170
type GRPCRouteMetadata struct {
153171
// The name of the route.
@@ -177,6 +195,10 @@ type GRPCRouteMatch struct {
177195
// +kubebuilder:validation:MaxItems=10
178196
// +optional
179197
Metadata []GRPCRouteMetadata `json:"metadata,omitempty"`
198+
// Specifies the port to match requests with
199+
// +kubebuilder:validation:Minimum=0
200+
// +optional
201+
Port *int64 `json:"port,omitempty"`
180202
}
181203

182204
// GRPCRouteAction refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_GrpcRouteAction.html
@@ -277,7 +299,6 @@ type VirtualRouterSpec struct {
277299
AWSName *string `json:"awsName,omitempty"`
278300
// The listeners that the virtual router is expected to receive inbound traffic from
279301
// +kubebuilder:validation:MinItems=1
280-
// +kubebuilder:validation:MaxItems=1
281302
Listeners []VirtualRouterListener `json:"listeners,omitempty"`
282303

283304
// The routes associated with VirtualRouter

config/crd/bases/appmesh.k8s.aws_gatewayroutes.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ spec:
7878
description: An object that represents the target that traffic
7979
is routed to when a request matches the route.
8080
properties:
81+
port:
82+
description: Specifies the port of the gateway route target
83+
format: int64
84+
minimum: 0
85+
type: integer
8186
virtualService:
8287
description: The virtual service to associate with the
8388
gateway route target.
@@ -199,6 +204,12 @@ spec:
199204
maxItems: 10
200205
minItems: 1
201206
type: array
207+
port:
208+
description: Specifies the port the request to be matched
209+
on
210+
format: int64
211+
minimum: 0
212+
type: integer
202213
serviceName:
203214
description: Either ServiceName or Hostname must be specified.
204215
Both are allowed as well The fully qualified domain name
@@ -258,6 +269,11 @@ spec:
258269
description: An object that represents the target that traffic
259270
is routed to when a request matches the route.
260271
properties:
272+
port:
273+
description: Specifies the port of the gateway route target
274+
format: int64
275+
minimum: 0
276+
type: integer
261277
virtualService:
262278
description: The virtual service to associate with the
263279
gateway route target.
@@ -408,6 +424,12 @@ spec:
408424
minLength: 1
409425
type: string
410426
type: object
427+
port:
428+
description: Specifies the port the request to be matched
429+
on
430+
format: int64
431+
minimum: 0
432+
type: integer
411433
prefix:
412434
description: Either Prefix or Hostname must be specified.
413435
Both are allowed as well. Specifies the prefix to match
@@ -486,6 +508,11 @@ spec:
486508
description: An object that represents the target that traffic
487509
is routed to when a request matches the route.
488510
properties:
511+
port:
512+
description: Specifies the port of the gateway route target
513+
format: int64
514+
minimum: 0
515+
type: integer
489516
virtualService:
490517
description: The virtual service to associate with the
491518
gateway route target.
@@ -636,6 +663,12 @@ spec:
636663
minLength: 1
637664
type: string
638665
type: object
666+
port:
667+
description: Specifies the port the request to be matched
668+
on
669+
format: int64
670+
minimum: 0
671+
type: integer
639672
prefix:
640673
description: Either Prefix or Hostname must be specified.
641674
Both are allowed as well. Specifies the prefix to match

config/crd/bases/appmesh.k8s.aws_virtualgateways.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ spec:
500500
required:
501501
- portMapping
502502
type: object
503-
maxItems: 1
504503
minItems: 0
505504
type: array
506505
logging:

config/crd/bases/appmesh.k8s.aws_virtualnodes.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,6 @@ spec:
876876
required:
877877
- portMapping
878878
type: object
879-
maxItems: 1
880879
minItems: 0
881880
type: array
882881
logging:

config/crd/bases/appmesh.k8s.aws_virtualrouters.yaml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ spec:
8282
required:
8383
- portMapping
8484
type: object
85-
maxItems: 1
8685
minItems: 1
8786
type: array
8887
meshRef:
@@ -120,6 +119,12 @@ spec:
120119
items:
121120
description: WeightedTarget refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_WeightedTarget.html
122121
properties:
122+
port:
123+
description: Specifies the targeted port of the
124+
weighted object
125+
format: int64
126+
minimum: 0
127+
type: integer
123128
virtualNodeARN:
124129
description: Amazon Resource Name to AppMesh VirtualNode
125130
object to associate with the weighted target.
@@ -236,6 +241,11 @@ spec:
236241
maxLength: 50
237242
minLength: 1
238243
type: string
244+
port:
245+
description: Specifies the port to match requests with
246+
format: int64
247+
minimum: 0
248+
type: integer
239249
serviceName:
240250
description: The fully qualified domain name for the
241251
service to match from the request.
@@ -363,6 +373,12 @@ spec:
363373
items:
364374
description: WeightedTarget refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_WeightedTarget.html
365375
properties:
376+
port:
377+
description: Specifies the targeted port of the
378+
weighted object
379+
format: int64
380+
minimum: 0
381+
type: integer
366382
virtualNodeARN:
367383
description: Amazon Resource Name to AppMesh VirtualNode
368384
object to associate with the weighted target.
@@ -502,6 +518,11 @@ spec:
502518
minLength: 1
503519
type: string
504520
type: object
521+
port:
522+
description: Specifies the port to match requests with
523+
format: int64
524+
minimum: 0
525+
type: integer
505526
prefix:
506527
description: Specifies the prefix to match requests
507528
with
@@ -643,6 +664,12 @@ spec:
643664
items:
644665
description: WeightedTarget refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_WeightedTarget.html
645666
properties:
667+
port:
668+
description: Specifies the targeted port of the
669+
weighted object
670+
format: int64
671+
minimum: 0
672+
type: integer
646673
virtualNodeARN:
647674
description: Amazon Resource Name to AppMesh VirtualNode
648675
object to associate with the weighted target.
@@ -782,6 +809,11 @@ spec:
782809
minLength: 1
783810
type: string
784811
type: object
812+
port:
813+
description: Specifies the port to match requests with
814+
format: int64
815+
minimum: 0
816+
type: integer
785817
prefix:
786818
description: Specifies the prefix to match requests
787819
with
@@ -931,6 +963,12 @@ spec:
931963
items:
932964
description: WeightedTarget refers to https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_WeightedTarget.html
933965
properties:
966+
port:
967+
description: Specifies the targeted port of the
968+
weighted object
969+
format: int64
970+
minimum: 0
971+
type: integer
934972
virtualNodeARN:
935973
description: Amazon Resource Name to AppMesh VirtualNode
936974
object to associate with the weighted target.
@@ -971,6 +1009,16 @@ spec:
9711009
required:
9721010
- weightedTargets
9731011
type: object
1012+
match:
1013+
description: An object that represents the criteria for
1014+
determining a request match.
1015+
properties:
1016+
port:
1017+
description: Specifies the port to match requests with
1018+
format: int64
1019+
minimum: 0
1020+
type: integer
1021+
type: object
9741022
timeout:
9751023
description: An object that represents a tcp timeout.
9761024
properties:
@@ -996,6 +1044,7 @@ spec:
9961044
type: object
9971045
required:
9981046
- action
1047+
- match
9991048
type: object
10001049
required:
10011050
- name

0 commit comments

Comments
 (0)