From 71a332dead98702b2be9790ae27280b22af03d0e Mon Sep 17 00:00:00 2001 From: Saylor Berman Date: Fri, 20 Dec 2024 13:55:36 -0700 Subject: [PATCH] Remove version config --- .../mode/static/nginx/config/generator.go | 8 -------- internal/mode/static/nginx/config/version.go | 19 ------------------ .../static/nginx/config/version_template.go | 12 ----------- .../mode/static/nginx/config/version_test.go | 20 ------------------- 4 files changed, 59 deletions(-) delete mode 100644 internal/mode/static/nginx/config/version.go delete mode 100644 internal/mode/static/nginx/config/version_template.go delete mode 100644 internal/mode/static/nginx/config/version_test.go diff --git a/internal/mode/static/nginx/config/generator.go b/internal/mode/static/nginx/config/generator.go index fcb2c0c03f..df43d0fb5c 100644 --- a/internal/mode/static/nginx/config/generator.go +++ b/internal/mode/static/nginx/config/generator.go @@ -47,9 +47,6 @@ const ( // streamConfigFile is the path to the configuration file with Stream configuration. streamConfigFile = streamFolder + "/stream.conf" - // configVersionFile is the path to the config version configuration file. - configVersionFile = httpFolder + "/config-version.conf" - // httpMatchVarsFile is the path to the http_match pairs configuration file. httpMatchVarsFile = httpFolder + "/matches.json" @@ -60,10 +57,6 @@ const ( mgmtIncludesFile = mainIncludesFolder + "/mgmt.conf" ) -// ConfigFolders is a list of folders where NGINX configuration files are stored. -// Volumes here also need to be added to our crossplane ephemeral test container. -var ConfigFolders = []string{httpFolder, secretsFolder, includesFolder, mainIncludesFolder, streamFolder} - // Generator generates NGINX configuration files. // This interface is used for testing purposes only. type Generator interface { @@ -198,7 +191,6 @@ func (g GeneratorImpl) getExecuteFuncs( g.executeStreamServers, g.executeStreamUpstreams, executeStreamMaps, - executeVersion, } } diff --git a/internal/mode/static/nginx/config/version.go b/internal/mode/static/nginx/config/version.go deleted file mode 100644 index 6e29f36056..0000000000 --- a/internal/mode/static/nginx/config/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package config - -import ( - gotemplate "text/template" - - "github.com/nginxinc/nginx-gateway-fabric/internal/framework/helpers" - "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/dataplane" -) - -var versionTemplate = gotemplate.Must(gotemplate.New("version").Parse(versionTemplateText)) - -func executeVersion(conf dataplane.Configuration) []executeResult { - result := executeResult{ - dest: configVersionFile, - data: helpers.MustExecuteTemplate(versionTemplate, conf.Version), - } - - return []executeResult{result} -} diff --git a/internal/mode/static/nginx/config/version_template.go b/internal/mode/static/nginx/config/version_template.go deleted file mode 100644 index ccf46e02cc..0000000000 --- a/internal/mode/static/nginx/config/version_template.go +++ /dev/null @@ -1,12 +0,0 @@ -package config - -const versionTemplateText = ` -server { - listen unix:/var/run/nginx/nginx-config-version.sock; - access_log off; - - location /version { - return 200 {{.}}; - } -} -` diff --git a/internal/mode/static/nginx/config/version_test.go b/internal/mode/static/nginx/config/version_test.go deleted file mode 100644 index 3d30c6c3b2..0000000000 --- a/internal/mode/static/nginx/config/version_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package config - -import ( - "testing" - - . "github.com/onsi/gomega" - - "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/dataplane" -) - -func TestExecuteVersion(t *testing.T) { - t.Parallel() - g := NewWithT(t) - - conf := dataplane.Configuration{Version: 42} - res := executeVersion(conf) - g.Expect(res).To(HaveLen(1)) - g.Expect(res[0].dest).To(Equal(configVersionFile)) - g.Expect(string(res[0].data)).To(ContainSubstring("return 200 42;")) -}