Skip to content

Add NGINX configuration for UpstreamSettingsPolicy #2877

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
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
78d1f01
Add NGINX configuration for UpstreamSettingsPolicy
bjee19 Dec 6, 2024
d39f4c0
Fix naming conventions, test messages, and add more comments
bjee19 Dec 9, 2024
1053ca2
Remove typo
bjee19 Dec 9, 2024
5f7eee7
Change funtionality so connection header value is empty when keep ali…
bjee19 Dec 9, 2024
a420810
Update generated files
bjee19 Dec 9, 2024
b188ef6
Add feedback for upstreams template
bjee19 Dec 10, 2024
939e782
Adjust comment in upstreams template
bjee19 Dec 10, 2024
032a6bc
Add feedback for naming of variables and fields
bjee19 Dec 10, 2024
7c403dd
Add upstreams test case for empty policy
bjee19 Dec 10, 2024
3618fbd
Add processor test case for multiple policies
bjee19 Dec 10, 2024
042cce5
Refactor generating proxy set headers
bjee19 Dec 10, 2024
95d3f8d
Add processor test case for processing non-UpstreamSettingsPolicies
bjee19 Dec 10, 2024
03f3c7e
Add another upstream test case
bjee19 Dec 10, 2024
c54b874
Fix upstream test case
bjee19 Dec 10, 2024
c53c24b
Extract keepalive settings outside of UpstreamSettings
bjee19 Dec 10, 2024
02705e0
Turn executeUpstreams into function
bjee19 Dec 10, 2024
513351e
Add UpstreamKeepAlive struct for http Upstream
bjee19 Dec 11, 2024
a2ace83
Add keepAliveChecker function
bjee19 Dec 11, 2024
b8a28a6
Add review feedback
bjee19 Dec 11, 2024
c489591
Adjust spacing in upstreams template
bjee19 Dec 11, 2024
65a5db6
Add end to end test for unset connection header
bjee19 Dec 11, 2024
db05606
Remove UpstreamSettingsProcessor interface and move UpstreamSettings …
bjee19 Dec 11, 2024
dd3f170
Refactor small code fix
bjee19 Dec 11, 2024
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
Prev Previous commit
Next Next commit
Add end to end test for unset connection header
  • Loading branch information
bjee19 committed Dec 11, 2024
commit 65a5db643a2db3fbd39451d6fd930c7ebb7c26cd
40 changes: 39 additions & 1 deletion internal/mode/static/nginx/config/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,18 @@ func TestCreateServers(t *testing.T) {
},
}

keepAliveGroup := dataplane.BackendGroup{
Source: hrNsName,
RuleIdx: 4,
Backends: []dataplane.Backend{
{
UpstreamName: "test_keep_alive_80",
Valid: true,
Weight: 1,
},
},
}

filterGroup1 := dataplane.BackendGroup{Source: hrNsName, RuleIdx: 3}

filterGroup2 := dataplane.BackendGroup{Source: hrNsName, RuleIdx: 4}
Expand Down Expand Up @@ -976,6 +988,16 @@ func TestCreateServers(t *testing.T) {
},
},
},
{
Path: "/keep-alive-enabled",
PathType: dataplane.PathTypeExact,
MatchRules: []dataplane.MatchRule{
{
Match: dataplane.Match{},
BackendGroup: keepAliveGroup,
},
},
},
}

conf := dataplane.Configuration{
Expand Down Expand Up @@ -1432,6 +1454,13 @@ func TestCreateServers(t *testing.T) {
Type: http.InternalLocationType,
Includes: internalIncludes,
},
{
Path: "= /keep-alive-enabled",
ProxyPass: "http://test_keep_alive_80$request_uri",
ProxySetHeaders: createBaseProxySetHeaders(httpUpgradeHeader, unsetHTTPConnectionHeader),
Type: http.ExternalLocationType,
Includes: externalIncludes,
},
}
}

Expand Down Expand Up @@ -1483,7 +1512,16 @@ func TestCreateServers(t *testing.T) {
Content: []byte("include-1"),
},
})
result, httpMatchPair := createServers(conf, fakeGenerator, alwaysFalseKeepAliveChecker)

keepAliveEnabledUpstream := http.Upstream{
Name: "test_keep_alive_80",
KeepAlive: http.UpstreamKeepAlive{
Connections: 1,
},
}
keepAliveCheck := newKeepAliveChecker([]http.Upstream{keepAliveEnabledUpstream})

result, httpMatchPair := createServers(conf, fakeGenerator, keepAliveCheck)

g.Expect(httpMatchPair).To(Equal(allExpMatchPair))
g.Expect(helpers.Diff(expectedServers, result)).To(BeEmpty())
Expand Down
Loading