Skip to content

Commit

Permalink
fix: move websocket config under config.route.v3.RouteAction (#2683)
Browse files Browse the repository at this point in the history
* fix: move websocket config under config.route.v3.RouteAction

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>

* fix testdata

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>

* tune logic in route translator

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>

---------

Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
  • Loading branch information
zetaab authored Feb 24, 2024
1 parent 62faf58 commit cfe3433
Showing 255 changed files with 427 additions and 189 deletions.
Original file line number Diff line number Diff line change
@@ -814,8 +814,6 @@ xds:
routeConfigName: default/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: default/eg/http
perConnectionBufferLimitBytes: 32768
@@ -1027,6 +1025,8 @@ xds:
name: httproute/default/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/default/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
- routeConfig:
'@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration
ignorePortInHostMatching: true
Original file line number Diff line number Diff line change
@@ -210,8 +210,6 @@ xds:
routeConfigName: default/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: default/eg/http
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
@@ -570,11 +570,6 @@
},
"serverHeaderTransformation": "PASS_THROUGH",
"statPrefix": "http",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
],
"useRemoteAddress": true
}
}
@@ -923,7 +918,12 @@
},
"name": "httproute/default/backend/rule/0/match/0/www_example_com",
"route": {
"cluster": "httproute/default/backend/rule/0"
"cluster": "httproute/default/backend/rule/0",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
]
}
}
]
Original file line number Diff line number Diff line change
@@ -340,8 +340,6 @@ xds:
routeConfigName: default/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: default/eg/http
perConnectionBufferLimitBytes: 32768
@@ -553,6 +551,8 @@ xds:
name: httproute/default/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/default/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
- routeConfig:
'@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration
ignorePortInHostMatching: true
Original file line number Diff line number Diff line change
@@ -57,8 +57,6 @@ xds:
routeConfigName: default/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: default/eg/http
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ xds:
name: httproute/default/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/default/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
- routeConfig:
'@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration
ignorePortInHostMatching: true
Original file line number Diff line number Diff line change
@@ -447,11 +447,6 @@
},
"serverHeaderTransformation": "PASS_THROUGH",
"statPrefix": "http",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
],
"useRemoteAddress": true
}
}
@@ -485,7 +480,12 @@
},
"name": "httproute/envoy-gateway-system/backend/rule/0/match/0/www_example_com",
"route": {
"cluster": "httproute/envoy-gateway-system/backend/rule/0"
"cluster": "httproute/envoy-gateway-system/backend/rule/0",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
]
},
"typedPerFilterConfig": {
"envoy.filters.http.jwt_authn": {
Original file line number Diff line number Diff line change
@@ -267,8 +267,6 @@ xds:
routeConfigName: envoy-gateway-system/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: envoy-gateway-system/eg/http
perConnectionBufferLimitBytes: 32768
@@ -288,6 +286,8 @@ xds:
name: httproute/envoy-gateway-system/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/envoy-gateway-system/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.jwt_authn:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.PerRouteConfig
Original file line number Diff line number Diff line change
@@ -74,8 +74,6 @@ xds:
routeConfigName: envoy-gateway-system/eg/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http
upgradeConfigs:
- upgradeType: websocket
useRemoteAddress: true
name: envoy-gateway-system/eg/http
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ xds:
name: httproute/envoy-gateway-system/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/envoy-gateway-system/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.jwt_authn:
'@type': type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.PerRouteConfig
14 changes: 12 additions & 2 deletions internal/cmd/egctl/testdata/translate/out/multiple-xds.route.json
Original file line number Diff line number Diff line change
@@ -21,7 +21,12 @@
},
"name": "httproute/default/backend/rule/0/match/0/www_example_com",
"route": {
"cluster": "httproute/default/backend/rule/0"
"cluster": "httproute/default/backend/rule/0",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
]
}
}
]
@@ -52,7 +57,12 @@
},
"name": "httproute/default/backend/rule/0/match/0/www_example2_com",
"route": {
"cluster": "httproute/default/backend/rule/0"
"cluster": "httproute/default/backend/rule/0",
"upgradeConfigs": [
{
"upgradeType": "websocket"
}
]
}
}
]
Original file line number Diff line number Diff line change
@@ -16,3 +16,5 @@ xds:
name: httproute/envoy-gateway-system/backend/rule/0/match/0/www_example_com
route:
cluster: httproute/envoy-gateway-system/backend/rule/0
upgradeConfigs:
- upgradeType: websocket
3 changes: 3 additions & 0 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
@@ -213,6 +213,7 @@ func (t *Translator) processHTTPRouteRules(httpRoute *HTTPRouteContext, parentRe
StatusCode: 500,
}
}
ruleRoute.IsHTTP2 = false
}

// TODO handle:
@@ -495,6 +496,7 @@ func (t *Translator) processGRPCRouteRules(grpcRoute *GRPCRouteContext, parentRe
StatusCode: 500,
}
}
ruleRoute.IsHTTP2 = true
}

// TODO handle:
@@ -658,6 +660,7 @@ func (t *Translator) processHTTPRouteParentRefListener(route RouteContext, route
ExtensionRefs: routeRoute.ExtensionRefs,
Timeout: routeRoute.Timeout,
Retry: routeRoute.Retry,
IsHTTP2: routeRoute.IsHTTP2,
}
// Don't bother copying over the weights unless the route has invalid backends.
if routeRoute.BackendWeights.Invalid > 0 {
Original file line number Diff line number Diff line change
@@ -360,6 +360,7 @@ xdsIR:
directResponse:
statusCode: 500
hostname: '*'
isHTTP2: false
name: httproute/envoy-gateway/httproute-1/rule/0/match/0/*
pathMatch:
distinct: false
@@ -390,4 +391,5 @@ xdsIR:
exact: foo
name: magic
hostname: '*'
isHTTP2: true
name: grpcroute/envoy-gateway/grpcroute-1/rule/0/match/0/*
Original file line number Diff line number Diff line change
@@ -333,6 +333,7 @@ xdsIR:
fixedDelay: 5.4s
percentage: 80
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
envoy-gateway/gateway-2:
accessLog:
@@ -366,6 +367,7 @@ xdsIR:
httpStatus: 14
percentage: 0.01
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-2/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
@@ -391,6 +393,7 @@ xdsIR:
fixedDelay: 5.4s
percentage: 80
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -257,6 +257,7 @@ xdsIR:
protocol: GRPC
weight: 1
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
envoy-gateway/gateway-2:
accessLog:
Original file line number Diff line number Diff line change
@@ -266,6 +266,7 @@ xdsIR:
protocol: GRPC
weight: 1
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
envoy-gateway/gateway-2:
accessLog:
@@ -300,6 +301,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -459,6 +459,7 @@ xdsIR:
interval: 2s
maxEjectionPercent: 100
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
envoy-gateway/gateway-2:
accessLog:
@@ -503,6 +504,7 @@ xdsIR:
interval: 1s
maxEjectionPercent: 100
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-2/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
@@ -536,6 +538,7 @@ xdsIR:
interval: 8ms
maxEjectionPercent: 11
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-3/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
@@ -572,6 +575,7 @@ xdsIR:
interval: 1s
maxEjectionPercent: 100
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -341,6 +341,7 @@ xdsIR:
protocol: GRPC
weight: 1
hostname: '*'
isHTTP2: true
loadBalancer:
random: {}
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
@@ -372,6 +373,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
loadBalancer:
leastRequest:
slowStart:
@@ -394,6 +396,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
loadBalancer:
consistentHash:
sourceIP: true
Original file line number Diff line number Diff line change
@@ -167,6 +167,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -171,6 +171,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -167,6 +167,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -173,6 +173,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -170,6 +170,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -255,6 +255,7 @@ xdsIR:
protocol: GRPC
weight: 1
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
proxyProtocol:
version: V1
@@ -286,6 +287,7 @@ xdsIR:
protocol: HTTP
weight: 1
hostname: gateway.envoyproxy.io
isHTTP2: false
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
pathMatch:
distinct: false
Original file line number Diff line number Diff line change
@@ -153,4 +153,5 @@ xdsIR:
protocol: GRPC
weight: 1
hostname: '*'
isHTTP2: true
name: grpcroute/default/grpcroute-1/rule/0/match/-1/*
Loading

0 comments on commit cfe3433

Please sign in to comment.