8000 [Feature] [Platform] Route Upstream Timeout (#1796) · arangodb/kube-arangodb@36105b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 36105b7

Browse files
authored
[Feature] [Platform] Route Upstream Timeout (#1796)
1 parent 27d3e61 commit 36105b7

25 files changed

+541
-118
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
- (Bugfix) (Platform) Proper Path handler in StorageV2
4747
- (Feature) Helm Chart Values merge methods
4848
- (Feature) (Platform) Expose Route Name via Header
49+
- (Feature) (Platform) Route Upstream Timeout
4950

5051
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
5152
- (Feature) ArangoRoute CRD

docs/api/ArangoRoute.V1Alpha1.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ UID keeps the information about object UID
8383

8484
### .spec.destination.path
8585

86-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L46)</sup>
86+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L51)</sup>
8787

8888
Path defines service path used for overrides
8989

9090
***
9191

9292
### .spec.destination.protocol
9393

94-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L40)</sup>
94+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L45)</sup>
9595

9696
Protocol defines http protocol used for the route
9797

@@ -103,7 +103,7 @@ Possible Values:
103103

104104
### .spec.destination.schema
105105

106-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L35)</sup>
106+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L40)</sup>
107107

108108
Schema defines HTTP/S schema used for connection
109109

@@ -153,6 +153,14 @@ UID keeps the information about object UID
153153

154154
***
155155

156+
### .spec.destination.timeout
157+
158+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L57)</sup>
159+
160+
Timeout specify the upstream request timeout
161+
162+
***
163+
156164
### .spec.destination.tls.insecure
157165

158166
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go#L25)</sup>
@@ -273,20 +281,28 @@ Possible Values:
273281

274282
### .status.target.path
275283

276-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L49)</sup>
284+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L51)</sup>
277285

278286
Path specifies request path override
279287

280288
***
281289

282290
### .status.target.protocol
283291

284-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L40)</sup>
292+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L42)</sup>
285293

286294
Protocol defines http protocol used for the route
287295

288296
***
289297

298+
### .status.target.timeout
299+
300+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L54)</sup>
301+
302+
Timeout specify the upstream request timeout
303+
304+
***
305+
290306
### .status.target.tls.insecure
291307

292308
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target_tls.go#L27)</sup>
@@ -297,7 +313,7 @@ Insecure allows Insecure traffic
297313

298314
### .status.target.type
299315

300-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L34)</sup>
316+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L36)</sup>
301317

302318
Type define destination type
303319

pkg/apis/networking/v1alpha1/route_spec_destination.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -20,7 +20,12 @@
2020

2121
package v1alpha1
2222

23-
import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
23+
import (
24+
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
26+
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
27+
"github.com/arangodb/kube-arangodb/pkg/util/constants"
28+
)
2429

2530
type ArangoRouteSpecDestination struct {
2631
// Service defines service upstream reference
@@ -47,6 +52,9 @@ type ArangoRouteSpecDestination struct {
4752

4853
// Authentication defines auth methods
4954
Authentication *ArangoRouteSpecDestinationAuthentication `json:"authentication,omitempty"`
55+
56+
// Timeout specify the upstream request timeout
57+
Timeout *meta.Duration `json:"timeout,omitempty"`
5058
}
5159

5260
func (a *ArangoRouteSpecDestination) GetService() *ArangoRouteSpecDestinationService {
@@ -89,6 +97,16 @@ func (a *ArangoRouteSpecDestination) GetPath() string {
8997
return *a.Path
9098
}
9199

100+
func (a *ArangoRouteSpecDestination) GetTimeout() meta.Duration {
101+
if a == nil || a.Timeout == nil {
102+
return meta.Duration{
103+
Duration: constants.DefaultEnvoyUpstreamTimeout,
104+
}
105+
}
106+
107+
return *a.Timeout
108+
}
109+
92110
func (a *ArangoRouteSpecDestination) GetTLS() *ArangoRouteSpecDestinationTLS {
93111
if a == nil || a.TLS == nil {
94112
return nil

pkg/apis/networking/v1alpha1/route_status_target.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ package v1alpha1
2323
import (
2424
"fmt"
2525

26+
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
27+
2628
"github.com/arangodb/kube-arangodb/pkg/util"
2729
)
2830

@@ -47,6 +49,9 @@ type ArangoRouteStatusTarget struct {
4749

4850
// Path specifies request path override
4951
Path string `json:"path,omitempty"`
52+
53+
// Timeout specify the upstream request timeout
54+
Timeout meta.Duration `json:"timeout,omitempty"`
5055
}
5156

5257
func (a *ArangoRouteStatusTarget) RenderURLs() []string {
@@ -73,5 +78,5 @@ func (a *ArangoRouteStatusTarget) Hash() string {
7378
if a == nil {
7479
return ""
7580
}
76-
return util.SHA256FromStringArray(a.Destinations.Hash(), a.Type.Hash(), a.TLS.Hash(), a.Protocol.String(), a.Path, a.Authentication.Hash(), a.Options.Hash())
81+
return util.SHA256FromStringArray(a.Destinations.Hash(), a.Type.Hash(), a.TLS.Hash(), a.Protocol.String(), a.Path, a.Authentication.Hash(), a.Options.Hash(), a.Timeout.String())
7782
}

pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/shared/errors.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -53,6 +53,11 @@ func (p *ResourceError) Format(s fmt.State, verb rune) {
5353
}
5454
}
5555

56+
// PrefixResourceErrorFunc creates new prefixed error from func output. If error is already prefixed then current key is appended
57+
func PrefixResourceErrorFunc(prefix string, f func() error) error {
58+
return PrefixResourceError(prefix, f())
59+
}
60+
5661
// PrefixResourceError creates new prefixed error. If error is already prefixed then current key is appended
5762
func PrefixResourceError(prefix string, err error) error {
5863
if err == nil {

pkg/crd/crds/networking-route.schema.generated.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ v1alpha1:
8181
description: UID keeps the information about object UID
8282
type: string
8383
type: object
84+
timeout:
85+
description: Timeout specify the upstream request timeout
86+
type: string
8487
tls:
8588
description: TLS defines TLS Configuration
8689
properties:

0 commit comments

Comments
 (0)
0