8000 [Feature] [Platform] Route Upstream Timeout by ajanikow · Pull Request #1796 · arangodb/kube-arangodb · GitHub
[go: up one dir, main page]

Skip to content

[Feature] [Platform] Route Upstream Timeout #1796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- (Bugfix) (Platform) Proper Path handler in StorageV2
- (Feature) Helm Chart Values merge methods
- (Feature) (Platform) Expose Route Name via Header
- (Feature) (Platform) Route Upstream Timeout

## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
- (Feature) ArangoRoute CRD
Expand Down
28 changes: 22 additions & 6 deletions docs/api/ArangoRoute.V1Alpha1.md
8000
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ UID keeps the information about object UID

### .spec.destination.path

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

Path defines service path used for overrides

***

### .spec.destination.protocol

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

Protocol defines http protocol used for the route

Expand All @@ -103,7 +103,7 @@ Possible Values:

### .spec.destination.schema

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

Schema defines HTTP/S schema used for connection

Expand Down Expand Up @@ -153,6 +153,14 @@ UID keeps the information about object UID

***

### .spec.destination.timeout

Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_spec_destination.go#L57)</sup>

Timeout specify the upstream request timeout

***

### .spec.destination.tls.insecure

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>
Expand Down Expand Up @@ -273,20 +281,28 @@ Possible Values:

### .status.target.path

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

Path specifies request path override

***

### .status.target.protocol

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

Protocol defines http protocol used for the route

***

### .status.target.timeout

Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.43/pkg/apis/networking/v1alpha1/route_status_target.go#L54)</sup>

Timeout specify the upstream request timeout

***

### .status.target.tls.insecure

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>
Expand All @@ -297,7 +313,7 @@ Insecure allows Insecure traffic

### .status.target.type

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

Type define destination type

22 changes: 20 additions & 2 deletions pkg/apis/networking/v1alpha1/route_spec_destination.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,12 @@

package v1alpha1

import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"

shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
)

type ArangoRouteSpecDestination struct {
// Service defines service upstream reference
Expand All @@ -47,6 +52,9 @@ type ArangoRouteSpecDestination struct {

// Authentication defines auth methods
Authentication *ArangoRouteSpecDestinationAuthentication `json:"authentication,omitempty"`

// Timeout specify the upstream request timeout
Timeout *meta.Duration `json:"timeout,omitempty"`
}

func (a *ArangoRouteSpecDestination) GetService() *ArangoRouteSpecDestinationService {
Expand Down Expand Up @@ -89,6 +97,16 @@ func (a *ArangoRouteSpecDestination) GetPath() string {
return *a.Path
}

func (a *ArangoRouteSpecDestination) GetTimeout() meta.Duration {
if a == nil || a.Timeout == nil {
return meta.Duration{
Duration: constants.DefaultEnvoyUpstreamTimeout,
}
}

return *a.Timeout
}

func (a *ArangoRouteSpecDestination) GetTLS() *ArangoRouteSpecDestinationTLS {
if a == nil || a.TLS == nil {
return nil
Expand Down
9 changes: 7 additions & 2 deletions pkg/apis/networking/v1alpha1/route_status_target.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,8 @@ package v1alpha1
import (
"fmt"

meta "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/arangodb/kube-arangodb/pkg/util"
)

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

// Path specifies request path override
Path string `json:"path,omitempty"`

// Timeout specify the upstream request timeout
Timeout meta.Duration `json:"timeout,omitempty"`
}

func (a *ArangoRouteStatusTarget) RenderURLs() []string {
Expand All @@ -73,5 +78,5 @@ func (a *ArangoRouteStatusTarget) Hash() string {
if a == nil {
return ""
}
return util.SHA256FromStringArray(a.Destinations.Hash(), a.Type.Hash(), a.TLS.Hash(), a.Protocol.String(), a.Path, a.Authentication.Hash(), a.Options.Hash())
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())
}
15 changes: 11 additions & 4 deletions pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg/apis/shared/errors.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,6 +53,11 @@ func (p *ResourceError) Format(s fmt.State, verb rune) {
}
}

// PrefixResourceErrorFunc creates new prefixed error from func output. If error is already prefixed then current key is appended
func PrefixResourceErrorFunc(prefix string, f func() error) error {
return PrefixResourceError(prefix, f())
}

// PrefixResourceError creates new prefixed error. If error is already prefixed then current key is appended
func PrefixResourceError(prefix string, err error) error {
if err == nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/crd/crds/networking-route.schema.generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ v1alpha1:
description: UID keeps the information about object UID
type: string
type: object
timeout:
description: Timeout specify the upstream request timeout
type: string
tls:
description: TLS defines TLS Configuration
properties:
Expand Down
Loading
0