8000 [Feature] [Platform] Expose Route Name via Header · arangodb/kube-arangodb@4f91b08 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f91b08

Browse files
committed
[Feature] [Platform] Expose Route Name via Header
1 parent a5f5804 commit 4f91b08

File tree

6 files changed

+159
-83
lines changed

6 files changed

+159
-83
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- (Feature) Improve Helm Chart Manager
4646
- (Bugfix) (Platform) Proper Path handler in StorageV2
4747
- (Feature) Helm Chart Values merge methods
48+
- (Feature) (Platform) Expose Route Name via Header
4849

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

integrations/scheduler/v2/definition/helm.pb.go

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

integrations/scheduler/v2/definition/helm.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ message SchedulerV2InstallRequest {
102102
message SchedulerV2InstallRequestOptions {
103103
// Release Labels
104104
map<string, string> labels = 1;
105+
106+
// Waits for the upgrade to be completed
107+
optional bool wait = 2;
105108
}
106109

107110
// Response
@@ -130,6 +133,9 @@ message SchedulerV2UpgradeRequest {
130133
message SchedulerV2UpgradeRequestOptions {
131134
// Release Labels
132135
map<string, string> labels = 1;
136+
137+
// Waits for the upgrade to be completed
138+
optional bool wait = 2;
133139
}
134140

135141
// Response
@@ -154,6 +160,8 @@ message SchedulerV2UninstallRequest {
154160

155161
// Request Options
156162
message SchedulerV2UninstallRequestOptions {
163+
// Waits for the upgrade to be completed
164+
optional bool wait = 1;
157165
}
158166

159167
// Response

integrations/scheduler/v2/definition/helpers.go

Lines changed: 7 additions & 1 deletion
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.
@@ -91,6 +91,7 @@ func (i *SchedulerV2InstallRequestOptions) Options() []util.Mod[action.Install]
9191
if v := i.GetLabels(); len(v) > 0 {
9292
opts = append(opts, func(in *action.Install) {
9393
in.Labels = v
94+
in.Wait = util.OptionalType(i.Wait, false)
9495
})
9596
}
9697

@@ -107,6 +108,7 @@ func (i *SchedulerV2UpgradeRequestOptions) Options() []util.Mod[action.Upgrade]
107108
if v := i.GetLabels(); len(v) > 0 {
108109
opts = append(opts, func(in *action.Upgrade) {
109110
in.Labels = v
111+
in.Wait = util.OptionalType(i.Wait, false)
110112
})
111113
}
112114

@@ -144,6 +146,10 @@ func (i *SchedulerV2UninstallRequestOptions) Options() []util.Mod[action.Uninsta
144146

145147
var opts []util.Mod[action.Uninstall]
146148

149+
opts = append(opts, func(in *action.Uninstall) {
150+
in.Wait = util.OptionalType(i.Wait, false)
151+
})
152+
147153
return opts
148154
}
149155

pkg/deployment/resources/config_map_gateway.go

Lines changed: 8 additions & 1 deletion
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.
@@ -44,6 +44,10 @@ import (
4444
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/patcher"
4545
)
4646

47+
const (
48+
EnvoyRouteHeader = "arangodb-platform-route"
49+
)
50+
4751
func (r *Resources) ensureGatewayConfig(ctx context.Context, cachedStatus inspectorInterface.Inspector, configMaps generic.ModClient[*core.ConfigMap]) error {
4852
deploymentName := r.context.GetAPIObject().GetName()
4953
configMapName := GetGatewayConfigMapName(deploymentName)
@@ -229,6 +233,9 @@ func (r *Resources) renderGatewayConfig(cachedStatus inspectorInterface.Inspecto
229233
pbImplEnvoyAuthV3.AuthConfigAuthPassModeKey: string(target.Authentication.PassMode),
230234
},
231235
}
236+
dest.ResponseHeaders = map[string]string{
237+
EnvoyRouteHeader: at.GetName(),
238+
}
232239
cfg.Destinations[at.Spec.GetRoute().GetPath()] = dest
233240
}
234241

pkg/deployment/resources/gateway/gateway_config_destination.go

Lines changed: 18 additions & 1 deletion
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.
@@ -24,6 +24,7 @@ import (
2424
"time"
2525

2626
clusterAPI "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
27+
coreAPI "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
2728
endpointAPI "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
2829
routeAPI "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
2930
"google.golang.org/protobuf/types/known/anypb"
@@ -70,6 +71,8 @@ type ConfigDestination struct {
7071
UpgradeConfigs ConfigDestinationsUpgrade `json:"upgradeConfigs,omitempty"`
7172

7273
TLS ConfigDestinationTLS `json:"tls,omitempty"`
74+
75+
ResponseHeaders map[string]string `json:"responseHeaders,omitempty"`
7376
}
7477

7578
func (c *ConfigDestination) Validate() error {
@@ -106,12 +109,26 @@ func (c *ConfigDestination) RenderRoute(name, prefix string) (*routeAPI.Route, e
106109
return nil, err
107110
}
108111

112+
var headers []*coreAPI.HeaderValueOption
113+
114+
for k, v := range c.ResponseHeaders {
115+
headers = append(headers, &coreAPI.HeaderValueOption{
116+
Header: &coreAPI.HeaderValue{
117+
Key: k,
118+
Value: v,
119+
},
120+
AppendAction: coreAPI.HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD,
121+
KeepEmptyValue: false,
122+
})
123+
}
124+
109125
return &routeAPI.Route{
110126
Match: &routeAPI.RouteMatch{
111127
PathSpecifier: &routeAPI.RouteMatch_Prefix{
112128
Prefix: prefix,
113129
},
114130
},
131+
ResponseHeadersToAdd: headers,
115132
Action: &routeAPI.Route_Route{
116133
Route: &routeAPI.RouteAction{
117134
ClusterSpecifier: &routeAPI.RouteAction_Cluster{

0 commit comments

Comments
 (0)
0