Skip to content

Commit 61fc20e

Browse files
authored
[Feature] [Platform] Request ID & Header Standardization (#1990)
1 parent 491f7d8 commit 61fc20e

File tree

5 files changed

+63
-6
lines changed

5 files changed

+63
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- (Bugfix) (Platform) Fix Monitoring RBAC
2020
- (Feature) (Platform) Do not require LM during install commands
2121
- (Feature) (Platform) ArangoRoute Redirect
22+
- (Feature) (Platform) Request ID & Header Standardization
2223

2324
## [1.3.1](https://github.com/arangodb/kube-arangodb/tree/1.3.1) (2025-10-07)
2425
- (Documentation) Add ArangoPlatformStorage Docs & Examples

integrations/envoy/auth/v3/impl/impl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ import (
2626
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/auth_custom"
2727
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/auth_required"
2828
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/pass_mode"
29+
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/request_id"
2930
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/required"
3031
"github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/impl/users"
3132
pbImplEnvoyAuthV3Shared "github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/shared"
3233
)
3334

3435
func Factory() pbImplEnvoyAuthV3Shared.Factory {
3536
return pbImplEnvoyAuthV3Shared.NewFactory(
37+
request_id.New,
3638
required.New,
3739
auth_bearer.New,
3840
auth_cookie.New,
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package request_id
22+
23+
import (
24+
"context"
25+
26+
pbEnvoyCoreV3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
27+
pbEnvoyAuthV3 "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
28+
"k8s.io/apimachinery/pkg/util/uuid"
29+
30+
pbImplEnvoyAuthV3Shared "github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3/shared"
31+
utilConstants "github.com/arangodb/kube-arangodb/pkg/util/constants"
32+
)
33+
34+
func New(ctx context.Context, configuration pbImplEnvoyAuthV3Shared.Configuration) (pbImplEnvoyAuthV3Shared.AuthHandler, bool) {
35+
return impl{}, true
36+
}
37+
38+
type impl struct {
39+
}
40+
41+
func (a impl) Handle(ctx context.Context, request *pbEnvoyAuthV3.CheckRequest, current *pbImplEnvoyAuthV3Shared.Response) error {
42+
var header = pbEnvoyCoreV3.HeaderValueOption{
43+
Header: &pbEnvoyCoreV3.HeaderValue{
44+
Key: utilConstants.EnvoyRequestIDHeader,
45+
Value: string(uuid.NewUUID()),
46+
},
47+
}
48+
current.Headers = append(current.Headers, &header)
49+
current.ResponseHeaders = append(current.ResponseHeaders, &header)
50+
51+
return nil
52+
}

pkg/deployment/resources/config_map_gateway.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ func (r *Resources) renderGatewayConfig(cachedStatus inspectorInterface.Inspecto
363363
dest.Match = util.NewType(gateway.ConfigMatchPath)
364364
dest.Type = util.NewType(gateway.ConfigDestinationTypeRedirect)
365365
dest.ResponseHeaders = map[string]string{
366-
utilConstants.EnvoyRouteHeader: at.GetName(),
366+
utilConstants.EnvoyRouteHeader: at.GetName(),
367+
utilConstants.EnvoyRouteHeaderV2: at.GetName(),
367368
}
368369
dest.AuthExtension = &gateway.ConfigAuthZExtension{
369370
AuthZExtension: map[string]string{
@@ -411,12 +412,12 @@ func (r *Resources) renderGatewayConfig(cachedStatus inspectorInterface.Inspecto
411412
},
412413
}
413414
dest.ResponseHeaders = map[string]string{
414-
utilConstants.EnvoyRouteHeader: at.GetName(),
415+
utilConstants.EnvoyRouteHeader: at.GetName(),
416+
utilConstants.EnvoyRouteHeaderV2: at.GetName(),
415417
}
416418
default:
417419
return errors.Errorf("Unknown route destination type %s", target.Type)
418420
}
419-
420421
cfg.Destinations[target.Route.Path] = dest
421422

422423
routes[at.GetName()] = &pbInventoryV1.InventoryNetworkingRoute{

pkg/util/constants/envoy.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
package constants
2222

2323
const (
24-
EnvoyRouteHeader = "arangodb-platform-route"
24+
// Deprecated: Use EnvoyRouteHeaderV2 instead
25+
EnvoyRouteHeader = "arangodb-platform-route"
26+
EnvoyRouteHeaderV2 = "X-Arango-Platform-Route"
27+
EnvoyRequestIDHeader = "X-Arango-Platform-Request-Id"
2528

2629
EnvoyInventoryConfigDestination = "/_inventory"
2730
EnvoyInventoryHashConfigDestination = "/_inventory.hash"
@@ -32,6 +35,4 @@ const (
3235
EnvoyIntegrationSidecarFilterName = "envoy.filters.http.ext_authz"
3336

3437
EnvoyIntegrationSidecarCluster = "integration_sidecar"
35-
36-
EnvoyIntegrationSidecarClusterHTTP = "integration_sidecar_http"
3738
)

0 commit comments

Comments
 (0)