Skip to content
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 @@ -21,6 +21,7 @@
- (Feature) (Platform) ArangoRoute Redirect
- (Feature) (Platform) Request ID & Header Standardization
- (Feature) (Platform) Install multi type support
- (Bugfix) (Platform) Sort Headers in Envoy

## [1.3.1](https://github.com/arangodb/kube-arangodb/tree/1.3.1) (2025-10-07)
- (Documentation) Add ArangoPlatformStorage Docs & Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ 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"
utilConstants "github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
Expand Down Expand Up @@ -163,7 +164,8 @@ func (c *ConfigDestination) RenderRoute(name, prefix string) (*pbEnvoyRouteV3.Ro
}
var headers []*pbEnvoyCoreV3.HeaderValueOption

for k, v := range c.ResponseHeaders {
for _, k := range util.SortKeys(c.ResponseHeaders) {
v := c.ResponseHeaders[k]
headers = append(headers, &pbEnvoyCoreV3.HeaderValueOption{
Header: &pbEnvoyCoreV3.HeaderValue{
Key: k,
Expand Down
30 changes: 26 additions & 4 deletions pkg/deployment/resources/gateway/gateway_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/tests/tgrpc"
)

func renderAndPrintGatewayConfig(t *testing.T, cfg Config, validates ...func(t *testing.T, b *pbEnvoyBootstrapV3.Bootstrap)) {
func renderAndPrintGatewayConfig(t *testing.T, cfg Config, validates ...func(t *testing.T, b *pbEnvoyBootstrapV3.Bootstrap)) string {
require.NoError(t, cfg.Validate())

data, checksum, obj, err := cfg.RenderYAML()
Expand All @@ -47,6 +47,8 @@ func renderAndPrintGatewayConfig(t *testing.T, cfg Config, validates ...func(t *
validates[id](t, obj)
})
}

return checksum
}

func Test_GatewayConfig(t *testing.T) {
Expand Down Expand Up @@ -467,15 +469,23 @@ func Test_GatewayConfig(t *testing.T) {
})

t.Run("Default", func(t *testing.T) {
renderAndPrintGatewayConfig(t, Config{
cfg := Config{
DefaultDestination: ConfigDestination{
Targets: []ConfigDestinationTarget{
{
Host: "127.0.0.1",
Port: 12345,
},
{
Host: "127.0.0.1",
Port: 12346,
},
{
Host: "127.0.0.1",
Port: 12347,
},
},
Path: util.NewType("/test/path/"),
Path: util.NewType("/"),
Type: util.NewType(ConfigDestinationTypeHTTPS),
},
Destinations: ConfigDestinations{
Expand All @@ -485,8 +495,20 @@ func Test_GatewayConfig(t *testing.T) {
},
Path: util.NewType("/test/path/"),
Type: util.NewType(ConfigDestinationTypeRedirect),
ResponseHeaders: map[string]string{
"A": "B",
"C": "C",
"D": "D",
},
},
},
})
}
a := renderAndPrintGatewayConfig(t, cfg)

for id := 0; id < 128; id++ {
t.Run(fmt.Sprintf("id:%d", id), func(t *testing.T) {
require.Equal(t, a, renderAndPrintGatewayConfig(t, cfg))
})
}
})
}
Loading