Skip to content

Commit

Permalink
Valid nginxproxy for http2
Browse files Browse the repository at this point in the history
  • Loading branch information
sjberman committed May 29, 2024
1 parent 807b758 commit ac840c4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/mode/static/state/dataplane/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ func buildBaseHTTPConfig(g *graph.Graph) BaseHTTPConfig {
// HTTP2 should be enabled by default
HTTP2: true,
}
if g.NginxProxy == nil {
if g.NginxProxy == nil || !g.NginxProxy.Valid {
return baseConfig
}

Expand Down
52 changes: 52 additions & 0 deletions internal/mode/static/state/dataplane/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,58 @@ func TestBuildConfiguration(t *testing.T) {
},
msg: "NginxProxy with tracing config and http2 disabled",
},
{
graph: &graph.Graph{
GatewayClass: &graph.GatewayClass{
Source: &v1.GatewayClass{},
Valid: true,
},
Gateway: &graph.Gateway{
Source: &v1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "gw",
Namespace: "ns",
},
},
Listeners: []*graph.Listener{
{
Name: "listener-80-1",
Source: listener80,
Valid: true,
Routes: map[graph.RouteKey]*graph.L7Route{},
},
},
},
Routes: map[graph.RouteKey]*graph.L7Route{},
NginxProxy: &graph.NginxProxy{
Valid: false,
Source: &ngfAPI.NginxProxy{
Spec: ngfAPI.NginxProxySpec{
DisableHTTP2: true,
Telemetry: &ngfAPI.Telemetry{
Exporter: &ngfAPI.TelemetryExporter{
Endpoint: "some-endpoint",
},
},
},
},
},
},
expConf: Configuration{
HTTPServers: []VirtualServer{
{
IsDefault: true,
Port: 80,
},
},
SSLServers: []VirtualServer{},
SSLKeyPairs: map[SSLKeyPairID]SSLKeyPair{},
CertBundles: map[CertBundleID]CertBundle{},
BaseHTTPConfig: BaseHTTPConfig{HTTP2: true},
Telemetry: Telemetry{},
},
msg: "invalid NginxProxy",
},
{
graph: &graph.Graph{
GatewayClass: &graph.GatewayClass{
Expand Down

0 comments on commit ac840c4

Please sign in to comment.