Skip to content

Commit

Permalink
restore backend weights to set only when invalid
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
  • Loading branch information
cnvergence committed May 15, 2024
1 parent e3f6bc0 commit 11bf097
Show file tree
Hide file tree
Showing 132 changed files with 14 additions and 1,443 deletions.
7 changes: 0 additions & 7 deletions internal/cmd/egctl/testdata/translate/out/quickstart.all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> 6c752632 (gofumpt)
name: httproute/envoy-gateway-system/backend/rule/0
settings:
- endpoints:
Expand Down
4 changes: 2 additions & 2 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ func (t *Translator) processHTTPRouteParentRefListener(route RouteContext, route
Mirrors: routeRoute.Mirrors,
ExtensionRefs: routeRoute.ExtensionRefs,
IsHTTP2: routeRoute.IsHTTP2,
BackendWeights: routeRoute.BackendWeights,
}
if routeRoute.Traffic != nil {
hostRoute.Traffic = &ir.TrafficFeatures{
Expand Down Expand Up @@ -1226,6 +1225,7 @@ func (t *Translator) processDestination(backendRefContext BackendRefContext,
gwapiv1a2.RouteReasonResolvedRefs,
"Mixed endpointslice address type for the same backendRef is not supported")
}

destinationFilters := t.processDestinationFilters(routeType, backendRefContext, parentRef, route, resources)
ds = &ir.DestinationSetting{
Weight: &weight,
Expand All @@ -1236,7 +1236,7 @@ func (t *Translator) processDestination(backendRefContext BackendRefContext,
Filters: destinationFilters,
}

return ds, weight
return ds
}

func getBackendFilters(routeType gwapiv1.Kind, backendRefContext BackendRefContext) (backendFilters any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/envoy-gateway/httproute-btls/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/envoy-gateway/httproute-btls/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/envoy-gateway/httproute-btls/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/envoy-gateway/httproute-btls/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/envoy-gateway/httproute-btls/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand All @@ -242,18 +235,11 @@ xdsIR:
distinct: false
name: ""
prefix: /foo
<<<<<<< HEAD
traffic:
loadBalancer:
consistentHash:
sourceIP: true
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-2/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: grpcroute/default/grpcroute-1/rule/0
settings:
- addressType: IP
Expand Down Expand Up @@ -382,14 +375,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-2/rule/0
settings:
- addressType: IP
Expand All @@ -406,19 +392,12 @@ xdsIR:
distinct: false
name: ""
prefix: /route2
<<<<<<< HEAD
traffic:
faultInjection:
abort:
httpStatus: 14
percentage: 0.01
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: grpcroute/default/grpcroute-1/rule/0
settings:
- addressType: IP
Expand Down Expand Up @@ -356,14 +349,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-2/rule/0
settings:
- addressType: IP
Expand All @@ -380,14 +366,7 @@ xdsIR:
distinct: false
name: ""
prefix: /foo
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
circuitBreaker:
maxConnections: 2048
maxParallelRequests: 4294967295
maxParallelRetries: 1024
maxPendingRequests: 1
maxRequestsPerConnection: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: grpcroute/default/grpcroute-1/rule/0
settings:
- addressType: IP
Expand Down Expand Up @@ -311,20 +298,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
circuitBreaker:
maxConnections: 42
maxParallelRequests: 42
maxParallelRetries: 24
maxPendingRequests: 42
maxRequestsPerConnection: 42
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: grpcroute/default/grpcroute-1/rule/0
settings:
- addressType: IP
Expand Down Expand Up @@ -530,14 +523,7 @@ xdsIR:
mergeSlashes: true
port: 10080
routes:
<<<<<<< HEAD
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-2/rule/0
settings:
- addressType: IP
Expand All @@ -554,7 +540,6 @@ xdsIR:
distinct: false
name: ""
prefix: /v2
<<<<<<< HEAD
traffic:
healthCheck:
active:
Expand All @@ -576,12 +561,6 @@ xdsIR:
maxEjectionPercent: 10
splitExternalLocalOriginErrors: false
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-3/rule/0
settings:
- addressType: IP
Expand All @@ -598,7 +577,6 @@ xdsIR:
distinct: false
name: ""
prefix: /v3
<<<<<<< HEAD
traffic:
healthCheck:
active:
Expand All @@ -620,12 +598,6 @@ xdsIR:
maxEjectionPercent: 11
splitExternalLocalOriginErrors: false
- destination:
=======
- backendWeights:
invalid: 0
valid: 1
destination:
>>>>>>> ca7809dc (add xds configuration)
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
Expand Down
Loading

0 comments on commit 11bf097

Please sign in to comment.