Skip to content

Commit

Permalink
Add a Name field to a IR Route Destination (#1788)
Browse files Browse the repository at this point in the history
* Add a Name field to a IR Route Destination

* Allows us to reduce and reuse the number
of xds clusters created which are per xRoute per rule
Fixes: #551

* Removes the hostname from the xds cluster name
since the xds cluster name is no longer tied to the
ir route name
Fixes: #1785

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* more test fixes

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* more tests

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* append `Kind` to IR Route and Destination

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix xds route to cluster mapping

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix test and lint

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix spelling

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix more tests

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix tlsroute, udproute & tcproute

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix nil ptr dereference

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* only add valid cluster if valid weight exists

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix func signature

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix rebase

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg authored Aug 21, 2023
1 parent c5c675f commit 4285f4e
Show file tree
Hide file tree
Showing 292 changed files with 2,164 additions and 1,657 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
{
"endpointConfig": {
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
"clusterName": "envoy-gateway-system/backend/rule/0/match/0-www.example.com",
"clusterName": "httproute/envoy-gateway-system/backend/rule/0",
"endpoints": [
{
"lbEndpoints": [
Expand Down Expand Up @@ -229,9 +229,9 @@
"ads": {},
"resourceApiVersion": "V3"
},
"serviceName": "envoy-gateway-system/backend/rule/0/match/0-www.example.com"
"serviceName": "httproute/envoy-gateway-system/backend/rule/0"
},
"name": "envoy-gateway-system/backend/rule/0/match/0-www.example.com",
"name": "httproute/envoy-gateway-system/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
"type": "EDS"
Expand Down Expand Up @@ -357,7 +357,7 @@
"typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication",
"providers": {
"envoy-gateway-system/backend/rule/0/match/0-www.example.com-example": {
"httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example": {
"remoteJwks": {
"asyncFetch": {},
"cacheDuration": "300s",
Expand All @@ -371,8 +371,8 @@
}
},
"requirementMap": {
"envoy-gateway-system/backend/rule/0/match/0-www.example.com": {
"providerName": "envoy-gateway-system/backend/rule/0/match/0-www.example.com-example"
"httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com": {
"providerName": "httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example"
}
}
}
Expand Down Expand Up @@ -431,14 +431,14 @@
"match": {
"pathSeparatedPrefix": "/foo"
},
"name": "envoy-gateway-system/backend/rule/0/match/0-www.example.com",
"name": "httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com",
"route": {
"cluster": "envoy-gateway-system/backend/rule/0/match/0-www.example.com"
"cluster": "httproute/envoy-gateway-system/backend/rule/0"
},
"typedPerFilterConfig": {
"envoy.filters.http.jwt_authn": {
"@type": "type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.PerRouteConfig",
"requirementName": "envoy-gateway-system/backend/rule/0/match/0-www.example.com"
"requirementName": "httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ xds:
dynamicEndpointConfigs:
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
clusterName: httproute/envoy-gateway-system/backend/rule/0
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -130,8 +130,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
name: envoy-gateway-system/backend/rule/0/match/0-www.example.com
serviceName: httproute/envoy-gateway-system/backend/rule/0
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand Down Expand Up @@ -213,7 +213,7 @@ xds:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
providers:
envoy-gateway-system/backend/rule/0/match/0-www.example.com-example:
httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example:
remoteJwks:
asyncFetch: {}
cacheDuration: 300s
Expand All @@ -223,8 +223,8 @@ xds:
uri: https://raw.githubusercontent.com/envoyproxy/gateway/main/examples/kubernetes/authn/jwks.json
retryPolicy: {}
requirementMap:
envoy-gateway-system/backend/rule/0/match/0-www.example.com:
providerName: envoy-gateway-system/backend/rule/0/match/0-www.example.com-example
httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com:
providerName: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
Expand Down Expand Up @@ -255,10 +255,10 @@ xds:
routes:
- match:
pathSeparatedPrefix: /foo
name: envoy-gateway-system/backend/rule/0/match/0-www.example.com
name: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com
route:
cluster: envoy-gateway-system/backend/rule/0/match/0-www.example.com
cluster: httproute/envoy-gateway-system/backend/rule/0
typedPerFilterConfig:
envoy.filters.http.jwt_authn:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.PerRouteConfig
requirementName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
requirementName: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
name: envoy-gateway-system/backend/rule/0/match/0-www.example.com
serviceName: httproute/envoy-gateway-system/backend/rule/0
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ xds:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
providers:
envoy-gateway-system/backend/rule/0/match/0-www.example.com-example:
httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example:
remoteJwks:
asyncFetch: {}
cacheDuration: 300s
Expand All @@ -57,8 +57,8 @@ xds:
uri: https://raw.githubusercontent.com/envoyproxy/gateway/main/examples/kubernetes/authn/jwks.json
retryPolicy: {}
requirementMap:
envoy-gateway-system/backend/rule/0/match/0-www.example.com:
providerName: envoy-gateway-system/backend/rule/0/match/0-www.example.com-example
httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com:
providerName: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com-example
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ xds:
routes:
- match:
pathSeparatedPrefix: /foo
name: envoy-gateway-system/backend/rule/0/match/0-www.example.com
name: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com
route:
cluster: envoy-gateway-system/backend/rule/0/match/0-www.example.com
cluster: httproute/envoy-gateway-system/backend/rule/0
typedPerFilterConfig:
envoy.filters.http.jwt_authn:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.PerRouteConfig
requirementName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
requirementName: httproute/envoy-gateway-system/backend/rule/0/match/0-www.example.com
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ xds:
dynamicEndpointConfigs:
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: default/backend/rule/0/match/0-www.example.com
clusterName: httproute/default/backend/rule/0
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -548,7 +548,7 @@ xds:
locality: {}
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: default/backend/rule/0/match/0-www.grpc-example.com
clusterName: grpcroute/default/backend/rule/0
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -561,7 +561,7 @@ xds:
locality: {}
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: default/eg/tls-passthrough/backend
clusterName: tlsroute/default/backend/rule/-1
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -574,7 +574,7 @@ xds:
locality: {}
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: default/eg/tcp/backend
clusterName: tcproute/default/backend/rule/-1
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -586,7 +586,7 @@ xds:
locality: {}
- endpointConfig:
'@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
clusterName: default/eg/udp/backend
clusterName: udproute/default/backend/rule/-1
endpoints:
- lbEndpoints:
- endpoint:
Expand All @@ -608,8 +608,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: default/backend/rule/0/match/0-www.example.com
name: default/backend/rule/0/match/0-www.example.com
serviceName: httproute/default/backend/rule/0
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand All @@ -623,8 +623,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: default/backend/rule/0/match/0-www.grpc-example.com
name: default/backend/rule/0/match/0-www.grpc-example.com
serviceName: grpcroute/default/backend/rule/0
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand All @@ -643,8 +643,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: default/eg/tls-passthrough/backend
name: default/eg/tls-passthrough/backend
serviceName: tlsroute/default/backend/rule/-1
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand All @@ -658,8 +658,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: default/eg/tcp/backend
name: default/eg/tcp/backend
serviceName: tcproute/default/backend/rule/-1
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand All @@ -673,8 +673,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: default/eg/udp/backend
name: default/eg/udp/backend
serviceName: udproute/default/backend/rule/-1
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Expand Down Expand Up @@ -839,7 +839,7 @@ xds:
inlineString: |
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"
path: /dev/stdout
cluster: default/eg/tls-passthrough/backend
cluster: tlsroute/default/backend/rule/-1
statPrefix: passthrough
listenerFilters:
- name: envoy.filters.listener.tls_inspector
Expand Down Expand Up @@ -881,7 +881,7 @@ xds:
inlineString: |
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"
path: /dev/stdout
cluster: default/eg/tcp/backend
cluster: tcproute/default/backend/rule/-1
statPrefix: tcp
name: default/eg/tcp/backend
perConnectionBufferLimitBytes: 32768
Expand Down Expand Up @@ -925,7 +925,7 @@ xds:
name: route
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.Route
cluster: default/eg/udp/backend
cluster: udproute/default/backend/rule/-1
statPrefix: service
name: default/eg/udp/backend
- '@type': type.googleapis.com/envoy.admin.v3.RoutesConfigDump
Expand All @@ -941,9 +941,9 @@ xds:
routes:
- match:
prefix: /
name: default/backend/rule/0/match/0-www.example.com
name: httproute/default/backend/rule/0/match/0-www.example.com
route:
cluster: default/backend/rule/0/match/0-www.example.com
cluster: httproute/default/backend/rule/0
- routeConfig:
'@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration
ignorePortInHostMatching: true
Expand All @@ -955,6 +955,6 @@ xds:
routes:
- match:
path: /com.example.Things/DoThing
name: default/backend/rule/0/match/0-www.grpc-example.com
name: grpcroute/default/backend/rule/0/match/0-www.grpc-example.com
route:
cluster: default/backend/rule/0/match/0-www.grpc-example.com
cluster: grpcroute/default/backend/rule/0
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ xds:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: envoy-gateway-system/backend/rule/0/match/0-www.example.com
name: envoy-gateway-system/backend/rule/0/match/0-www.example.com
serviceName: httproute/envoy-gateway-system/backend/rule/0
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
Loading

0 comments on commit 4285f4e

Please sign in to comment.