NGINX: Remove inline Lua from template. (#11806)

This commit is contained in:
Ricardo Katz 2024-09-08 18:48:12 -03:00 committed by GitHub
parent ee61440780
commit 6510535ae0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 361 additions and 233 deletions

View file

@ -25,10 +25,11 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/ingress-nginx/test/e2e/framework"
)
var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", func() {
var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers", func() {
f := framework.NewDefaultFramework("settings-tls")
host := "settings-tls"
@ -109,8 +110,9 @@ var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", f
ginkgo.It("setting max-age parameter", func() {
f.UpdateNginxConfigMapData(hstsMaxAge, "86400")
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, `hsts_max_age = 86400,`)
f.WaitForLuaConfiguration(func(jsonCfg map[string]interface{}) bool {
val, ok, err := unstructured.NestedString(jsonCfg, "hsts_max_age")
return err == nil && ok && val == "86400"
})
f.HTTPTestClientWithTLSConfig(tlsConfig).
@ -128,8 +130,9 @@ var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", f
hstsIncludeSubdomains: "false",
})
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, `hsts_include_subdomains = false,`)
f.WaitForLuaConfiguration(func(jsonCfg map[string]interface{}) bool {
val, ok, err := unstructured.NestedBool(jsonCfg, "hsts_include_subdomains")
return err == nil && ok && !val
})
f.HTTPTestClientWithTLSConfig(tlsConfig).
@ -148,8 +151,9 @@ var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", f
hstsIncludeSubdomains: "false",
})
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, `hsts_preload = true,`)
f.WaitForLuaConfiguration(func(jsonCfg map[string]interface{}) bool {
val, ok, err := unstructured.NestedBool(jsonCfg, "hsts_preload")
return err == nil && ok && val
})
f.HTTPTestClientWithTLSConfig(tlsConfig).