@@ -321,6 +321,21 @@ func setRequestTimeout(irTimeout *ir.Timeout, d metav1.Duration) {
321
321
}
322
322
}
323
323
324
+ func setTCPKeepalive (irRoute * ir.HTTPRoute , idleTime , interval uint32 ) {
325
+ // TODO(dilyevsky): Get this setting from the Proxy object. Put in reasonable defaults for now.
326
+ // https://linear.app/apoxy/issue/APO-258/implement-tcpkeepalive-settting
327
+ irRoute .TCPKeepalive = & ir.TCPKeepalive {
328
+ IdleTime : ptr .To (idleTime ),
329
+ Interval : ptr .To (interval ),
330
+ }
331
+ }
332
+
333
+ func setRetry (irRoute * ir.HTTPRoute ) {
334
+ // If this is not nil, defaults are set from:
335
+ // https://github.com/apoxy-dev/apoxy-cli/blob/fcf9377eba517845286065afda7746a8bf1dc076/pkg/gateway/xds/translator/route.go#L105-L106
336
+ irRoute .Retry = & ir.Retry {}
337
+ }
338
+
324
339
func (t * Translator ) processHTTPRouteRule (httpRoute * HTTPRouteContext , ruleIdx int , httpFiltersContext * HTTPFiltersContext , rule gwapiv1.HTTPRouteRule ) ([]* ir.HTTPRoute , error ) {
325
340
var ruleRoutes []* ir.HTTPRoute
326
341
@@ -330,12 +345,8 @@ func (t *Translator) processHTTPRouteRule(httpRoute *HTTPRouteContext, ruleIdx i
330
345
Name : irRouteName (httpRoute , ruleIdx , - 1 ),
331
346
}
332
347
processTimeout (irRoute , rule )
333
- // TODO(dilyevsky): Get this setting from the Proxy object. Put in reasonable defaults for now.
334
- // https://linear.app/apoxy/issue/APO-258/implement-tcpkeepalive-settting
335
- irRoute .TCPKeepalive = & ir.TCPKeepalive {
336
- IdleTime : ptr .To (uint32 (30 )),
337
- Interval : ptr .To (uint32 (10 )),
338
- }
348
+ setTCPKeepalive (irRoute , 30 , 10 )
349
+ setRetry (irRoute )
339
350
applyHTTPFiltersContextToIRRoute (httpFiltersContext , irRoute )
340
351
ruleRoutes = append (ruleRoutes , irRoute )
341
352
}
@@ -348,12 +359,8 @@ func (t *Translator) processHTTPRouteRule(httpRoute *HTTPRouteContext, ruleIdx i
348
359
Name : irRouteName (httpRoute , ruleIdx , matchIdx ),
349
360
}
350
361
processTimeout (irRoute , rule )
351
- // TODO(dilyevsky): Get this setting from the Proxy object. Put in reasonable defaults for now.
352
- // https://linear.app/apoxy/issue/APO-258/implement-tcpkeepalive-settting
353
- irRoute .TCPKeepalive = & ir.TCPKeepalive {
354
- IdleTime : ptr .To (uint32 (30 )),
355
- Interval : ptr .To (uint32 (10 )),
356
- }
362
+ setTCPKeepalive (irRoute , 30 , 10 )
363
+ setRetry (irRoute )
357
364
358
365
if match .Path != nil {
359
366
switch PathMatchTypeDerefOr (match .Path .Type , gwapiv1 .PathMatchPathPrefix ) {
@@ -577,6 +584,8 @@ func (t *Translator) processGRPCRouteRule(grpcRoute *GRPCRouteContext, ruleIdx i
577
584
irRoute := & ir.HTTPRoute {
578
585
Name : irRouteName (grpcRoute , ruleIdx , - 1 ),
579
586
}
587
+ setTCPKeepalive (irRoute , 30 , 10 )
588
+ setRetry (irRoute )
580
589
applyHTTPFiltersContextToIRRoute (httpFiltersContext , irRoute )
581
590
ruleRoutes = append (ruleRoutes , irRoute )
582
591
}
@@ -588,6 +597,8 @@ func (t *Translator) processGRPCRouteRule(grpcRoute *GRPCRouteContext, ruleIdx i
588
597
irRoute := & ir.HTTPRoute {
589
598
Name : irRouteName (grpcRoute , ruleIdx , matchIdx ),
590
599
}
600
+ setTCPKeepalive (irRoute , 30 , 10 )
601
+ setRetry (irRoute )
591
602
592
603
for _ , headerMatch := range match .Headers {
593
604
switch HeaderMatchTypeDerefOr (headerMatch .Type , gwapiv1 .HeaderMatchExact ) {
0 commit comments