Skip to content

Commit

Permalink
Add ServerStatusZones support in vs/vsr
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean-Coakley authored Sep 16, 2019
1 parent eb2a6e1 commit eff8c94
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/configs/version2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type UpstreamServer struct {
// Server defines a server.
type Server struct {
ServerName string
StatusZone string
ProxyProtocol bool
SSL *SSL
RedirectToHTTPSBasedOnXForwarderProto bool
Expand Down
1 change: 1 addition & 0 deletions internal/configs/version2/nginx-plus.virtualserver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ server {
listen 80{{ if $s.ProxyProtocol }} proxy_protocol{{ end }};

server_name {{ $s.ServerName }};
status_zone {{ $s.StatusZone }};

{{ with $ssl := $s.SSL }}
listen 443 ssl{{ if $ssl.HTTP2 }} http2{{ end }}{{ if $s.ProxyProtocol }} proxy_protocol{{ end }};
Expand Down
1 change: 1 addition & 0 deletions internal/configs/version2/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var virtualServerCfg = VirtualServerConfig{
},
Server: Server{
ServerName: "example.com",
StatusZone: "example.com",
ProxyProtocol: true,
SSL: &SSL{
HTTP2: true,
Expand Down
1 change: 1 addition & 0 deletions internal/configs/virtualserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ func generateVirtualServerConfig(virtualServerEx *VirtualServerEx, tlsPemFileNam
StatusMatches: statusMatches,
Server: version2.Server{
ServerName: virtualServerEx.VirtualServer.Spec.Host,
StatusZone: virtualServerEx.VirtualServer.Spec.Host,
ProxyProtocol: baseCfgParams.ProxyProtocol,
SSL: ssl,
RedirectToHTTPSBasedOnXForwarderProto: baseCfgParams.RedirectToHTTPS,
Expand Down
3 changes: 3 additions & 0 deletions internal/configs/virtualserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func TestGenerateVirtualServerConfig(t *testing.T) {
},
Server: version2.Server{
ServerName: "cafe.example.com",
StatusZone: "cafe.example.com",
ProxyProtocol: true,
RedirectToHTTPSBasedOnXForwarderProto: true,
ServerTokens: "off",
Expand Down Expand Up @@ -456,6 +457,7 @@ func TestGenerateVirtualServerConfigForVirtualServerWithSplits(t *testing.T) {
},
Server: version2.Server{
ServerName: "cafe.example.com",
StatusZone: "cafe.example.com",
InternalRedirectLocations: []version2.InternalRedirectLocation{
{
Path: "/tea",
Expand Down Expand Up @@ -713,6 +715,7 @@ func TestGenerateVirtualServerConfigForVirtualServerWithRules(t *testing.T) {
},
Server: version2.Server{
ServerName: "cafe.example.com",
StatusZone: "cafe.example.com",
InternalRedirectLocations: []version2.InternalRedirectLocation{
{
Path: "/tea",
Expand Down

0 comments on commit eff8c94

Please sign in to comment.