Fix golangci-lint errors (#10196)

* Fix golangci-lint errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix dupl errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix comments

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix errcheck lint errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix assert in e2e test

Signed-off-by: z1cheng <imchench@gmail.com>

* Not interrupt the waitForPodsReady

Signed-off-by: z1cheng <imchench@gmail.com>

* Replace string with constant

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix comments

Signed-off-by: z1cheng <imchench@gmail.com>

* Revert write file permision

Signed-off-by: z1cheng <imchench@gmail.com>

---------

Signed-off-by: z1cheng <imchench@gmail.com>
This commit is contained in:
Chen Chen 2023-08-31 15:36:48 +08:00 committed by GitHub
parent 46d87d3462
commit b3060bfbd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
253 changed files with 2434 additions and 2113 deletions

View file

@ -28,7 +28,6 @@ var _ = framework.DescribeSetting("access-log", func() {
f := framework.NewDefaultFramework("access-log")
ginkgo.Context("access-log-path", func() {
ginkgo.It("use the default configuration", func() {
f.WaitForNginxConfiguration(
func(cfg string) bool {
@ -50,7 +49,6 @@ var _ = framework.DescribeSetting("access-log", func() {
})
ginkgo.Context("http-access-log-path", func() {
ginkgo.It("use the specified configuration", func() {
f.UpdateNginxConfigMapData("http-access-log-path", "/tmp/nginx/http-access.log")
f.WaitForNginxConfiguration(
@ -63,7 +61,6 @@ var _ = framework.DescribeSetting("access-log", func() {
})
ginkgo.Context("stream-access-log-path", func() {
ginkgo.It("use the specified configuration", func() {
f.UpdateNginxConfigMapData("stream-access-log-path", "/tmp/nginx/stream-access.log")
f.WaitForNginxConfiguration(
@ -76,7 +73,6 @@ var _ = framework.DescribeSetting("access-log", func() {
})
ginkgo.Context("http-access-log-path & stream-access-log-path", func() {
ginkgo.It("use the specified configuration", func() {
f.SetNginxConfigMapData(map[string]string{
"http-access-log-path": "/tmp/nginx/http-access.log",

View file

@ -100,7 +100,6 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() {
})
ginkgo.It("[BAD_ANNOTATIONS] should allow an ingress if there is a default blocklist config in place", func() {
hostValid := "custom-allowed-value-test"
annotationsValid := map[string]string{
"nginx.ingress.kubernetes.io/configuration-snippet": `
@ -159,6 +158,5 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() {
WithHeader("Host", host).
Expect().
Status(http.StatusNotFound)
})
})

View file

@ -30,10 +30,12 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const fooHost = "foo"
var _ = framework.IngressNginxDescribe("[SSL] [Flag] default-ssl-certificate", func() {
f := framework.NewDefaultFramework("default-ssl-certificate")
var tlsConfig *tls.Config
secretName := "my-custom-cert"
secretName := "my-custom-cert" //nolint:gosec // Ignore the gosec error in testing
service := framework.EchoService
port := 80
@ -78,7 +80,7 @@ var _ = framework.IngressNginxDescribe("[SSL] [Flag] default-ssl-certificate", f
})
ginkgo.It("uses default ssl certificate for host based ingress when configured certificate does not match host", func() {
host := "foo"
host := fooHost
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, service, port, nil))
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,

View file

@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-catch-all", func() {
})
ginkgo.It("should ignore catch all Ingress with backend", func() {
host := "foo"
host := fooHost
ing := framework.NewSingleCatchAllIngress("catch-all", f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
@ -67,7 +67,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-catch-all", func() {
})
ginkgo.It("should ignore catch all Ingress with backend and rules", func() {
host := "foo"
host := fooHost
ing := framework.NewSingleIngressWithBackendAndRules(host, "/", host, f.Namespace, framework.EchoService, 80, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-catch-all", func() {
})
ginkgo.It("should delete Ingress updated to catch-all", func() {
host := "foo"
host := fooHost
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
@ -121,7 +121,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-catch-all", func() {
})
ginkgo.It("should allow Ingress with rules", func() {
host := "foo"
host := fooHost
ing := framework.NewSingleIngress("not-catch-all", "/", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)

View file

@ -95,6 +95,5 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-service-external-name", f
WithHeader("Host", externalhost).
Expect().
StatusRange(httpexpect.Status5xx)
})
})

View file

@ -50,6 +50,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
assert.NotEmpty(ginkgo.GinkgoT(), events.Items, "got events")
})
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should create sync events", func() {
host := "disable-sync-events-false"
f.NewEchoDeployment(framework.WithDeploymentReplicas(1))
@ -77,6 +78,7 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
assert.NotEmpty(ginkgo.GinkgoT(), events.Items, "got events")
})
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should not create sync events", func() {
host := "disable-sync-events-true"
f.NewEchoDeployment(framework.WithDeploymentReplicas(1))
@ -103,5 +105,4 @@ var _ = framework.IngressNginxDescribe("[Flag] disable-sync-events", func() {
assert.Empty(ginkgo.GinkgoT(), events.Items, "got events")
})
})

View file

@ -26,6 +26,8 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const forwardedHeadersHost = "forwarded-headers"
var _ = framework.DescribeSetting("use-forwarded-headers", func() {
f := framework.NewDefaultFramework("forwarded-headers")
@ -37,7 +39,7 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
})
ginkgo.It("should trust X-Forwarded headers when setting is true", func() {
host := "forwarded-headers"
host := forwardedHeadersHost
f.UpdateNginxConfigMapData(setting, "true")
@ -89,7 +91,7 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
})
ginkgo.It("should not trust X-Forwarded headers when setting is false", func() {
host := "forwarded-headers"
host := forwardedHeadersHost
f.UpdateNginxConfigMapData(setting, "false")

View file

@ -19,11 +19,10 @@ package settings
import (
"context"
"fmt"
"net/http"
"path/filepath"
"strings"
"net/http"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
@ -72,8 +71,7 @@ var _ = framework.DescribeSetting("Geoip2", func() {
f.UpdateNginxConfigMapData("use-geoip2", "true")
httpSnippetAllowingOnlyAustralia :=
`map $geoip2_city_country_code $blocked_country {
httpSnippetAllowingOnlyAustralia := `map $geoip2_city_country_code $blocked_country {
default 1;
AU 0;
}`
@ -85,8 +83,7 @@ var _ = framework.DescribeSetting("Geoip2", func() {
return strings.Contains(cfg, "map $geoip2_city_country_code $blocked_country")
})
configSnippet :=
`if ($blocked_country) {
configSnippet := `if ($blocked_country) {
return 403;
}`

View file

@ -31,6 +31,11 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const (
disable = "false"
noAuthLocaltionSetting = "no-auth-locations"
)
var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
f := framework.NewDefaultFramework(
"global-external-auth",
@ -46,7 +51,7 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
fooPath := "/foo"
barPath := "/bar"
noAuthSetting := "no-auth-locations"
noAuthSetting := noAuthLocaltionSetting
noAuthLocations := barPath
enableGlobalExternalAuthAnnotation := "nginx.ingress.kubernetes.io/enable-global-auth"
@ -56,7 +61,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.Context("when global external authentication is configured", func() {
ginkgo.BeforeEach(func() {
globalExternalAuthURL := fmt.Sprintf("http://%s.%s.svc.cluster.local:80/status/401", framework.HTTPBunService, f.Namespace)
@ -85,7 +89,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It("should return status code 401 when request any protected service", func() {
ginkgo.By("Sending a request to protected service /foo")
f.HTTPTestClient().
GET(fooPath).
@ -102,7 +105,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It("should return status code 200 when request whitelisted (via no-auth-locations) service and 401 when request protected service", func() {
ginkgo.By("Adding a no-auth-locations for /bar to configMap")
f.UpdateNginxConfigMapData(noAuthSetting, noAuthLocations)
f.WaitForNginxServer(host,
@ -126,10 +128,9 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It("should return status code 200 when request whitelisted (via ingress annotation) service and 401 when request protected service", func() {
ginkgo.By("Adding an ingress rule for /bar with annotation enable-global-auth = false")
err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, "bar-ingress", func(ingress *networking.Ingress) error {
ingress.ObjectMeta.Annotations[enableGlobalExternalAuthAnnotation] = "false"
ingress.ObjectMeta.Annotations[enableGlobalExternalAuthAnnotation] = disable
return nil
})
assert.Nil(ginkgo.GinkgoT(), err)
@ -155,9 +156,8 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It("should still return status code 200 after auth backend is deleted using cache", func() {
globalExternalAuthCacheKeySetting := "global-auth-cache-key"
globalExternalAuthCacheKey := "foo"
globalExternalAuthCacheKey := fooHost
globalExternalAuthCacheDurationSetting := "global-auth-cache-duration"
globalExternalAuthCacheDuration := "200 201 401 30m"
globalExternalAuthURL := fmt.Sprintf("http://%s.%s.svc.cluster.local:80/status/200", framework.HTTPBunService, f.Namespace)
@ -197,7 +197,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It(`should proxy_method method when global-auth-method is configured`, func() {
globalExternalAuthMethodSetting := "global-auth-method"
globalExternalAuthMethod := "GET"
@ -210,7 +209,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It(`should add custom error page when global-auth-signin url is configured`, func() {
globalExternalAuthSigninSetting := "global-auth-signin"
globalExternalAuthSignin := "http://foo.com/global-error-page"
@ -223,7 +221,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It(`should add auth headers when global-auth-response-headers is configured`, func() {
globalExternalAuthResponseHeadersSetting := "global-auth-response-headers"
globalExternalAuthResponseHeaders := "Foo, Bar"
@ -237,7 +234,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
})
ginkgo.It(`should set request-redirect when global-auth-request-redirect is configured`, func() {
globalExternalAuthRequestRedirectSetting := "global-auth-request-redirect"
globalExternalAuthRequestRedirect := "Foo-Redirect"
@ -260,7 +256,6 @@ var _ = framework.DescribeSetting("[Security] global-auth-url", func() {
return strings.Contains(server, globalExternalAuthSnippet)
})
})
})
ginkgo.Context("cookie set by external authentication server", func() {
@ -322,7 +317,6 @@ http {
f.WaitForNginxServer(host, func(server string) bool {
return strings.Contains(server, "server_name "+host)
})
})
ginkgo.It("user retains cookie by default", func() {

View file

@ -31,7 +31,6 @@ var _ = framework.IngressNginxDescribe("global-options", func() {
ginkgo.It("should have worker_rlimit_nofile option", func() {
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, fmt.Sprintf("worker_rlimit_nofile %d;", rlimitMaxNumFiles()-1024))
})
})

View file

@ -36,7 +36,6 @@ var _ = framework.DescribeSetting("hash size", func() {
})
ginkgo.Context("Check server names hash size", func() {
ginkgo.It("should set server_names_hash_bucket_size", func() {
f.UpdateNginxConfigMapData("server-name-hash-bucket-size", "512")
@ -52,11 +51,9 @@ var _ = framework.DescribeSetting("hash size", func() {
return strings.Contains(server, "server_names_hash_max_size 4096;")
})
})
})
ginkgo.Context("Check proxy header hash size", func() {
ginkgo.It("should set proxy-headers-hash-bucket-size", func() {
f.UpdateNginxConfigMapData("proxy-headers-hash-bucket-size", "512")
@ -72,11 +69,9 @@ var _ = framework.DescribeSetting("hash size", func() {
return strings.Contains(server, "proxy_headers_hash_max_size 4096;")
})
})
})
ginkgo.Context("Check the variable hash size", func() {
ginkgo.It("should set variables-hash-bucket-size", func() {
f.UpdateNginxConfigMapData("variables-hash-bucket-size", "512")
@ -92,11 +87,9 @@ var _ = framework.DescribeSetting("hash size", func() {
return strings.Contains(server, "variables_hash_max_size 512;")
})
})
})
ginkgo.Context("Check the map hash size", func() {
ginkgo.It("should set vmap-hash-bucket-size", func() {
f.UpdateNginxConfigMapData("map-hash-bucket-size", "512")
@ -104,7 +97,5 @@ var _ = framework.DescribeSetting("hash size", func() {
return strings.Contains(server, "map_hash_bucket_size 512;")
})
})
})
})

View file

@ -36,6 +36,8 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const barHost = "bar"
var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
f := framework.NewDefaultFramework("ingress-class")
@ -66,7 +68,7 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
ginkgo.Context("With default ingress class config", func() {
ginkgo.It("should ignore Ingress with a different class annotation", func() {
invalidHost := "foo"
invalidHost := fooHost
annotations := map[string]string{
ingressclass.IngressKey: "testclass",
}
@ -75,7 +77,7 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
ing.Spec.IngressClassName = nil
f.EnsureIngress(ing)
validHost := "bar"
validHost := barHost
annotationClass := map[string]string{
ingressclass.IngressKey: ingressclass.DefaultAnnotationValue,
}
@ -385,7 +387,6 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
Expect().
Status(http.StatusOK)
})
})
ginkgo.Context("With specific ingress-class flags", func() {
@ -411,13 +412,13 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
})
ginkgo.It("should ignore Ingress with no class and accept the correctly configured Ingresses", func() {
invalidHost := "bar"
invalidHost := barHost
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, nil)
ing.Spec.IngressClassName = nil
f.EnsureIngress(ing)
validHost := "foo"
validHost := fooHost
annotations := map[string]string{
ingressclass.IngressKey: "testclass",
}
@ -455,7 +456,6 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
Expect().
Status(http.StatusNotFound)
})
})
ginkgo.Context("With watch-ingress-without-class flag", func() {
@ -480,13 +480,13 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
})
ginkgo.It("should watch Ingress with no class and ignore ingress with a different class", func() {
validHost := "bar"
validHost := barHost
ing := framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, framework.EchoService, 80, nil)
ing.Spec.IngressClassName = nil
f.EnsureIngress(ing)
invalidHost := "foo"
invalidHost := fooHost
annotations := map[string]string{
ingressclass.IngressKey: "testclass123",
}
@ -511,7 +511,6 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
Expect().
Status(http.StatusNotFound)
})
})
ginkgo.Context("With ingress-class-by-name flag", func() {
@ -579,11 +578,9 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
Expect().
Status(http.StatusNotFound)
})
})
ginkgo.Context("Without IngressClass Cluster scoped Permission", func() {
ginkgo.BeforeEach(func() {
icname := fmt.Sprintf("ic-%s", f.Namespace)
@ -629,8 +626,7 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
})
ginkgo.It("should watch Ingress with correct annotation", func() {
validHost := "foo"
validHost := fooHost
annotations := map[string]string{
ingressclass.IngressKey: "testclass",
}
@ -650,7 +646,6 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
})
ginkgo.It("should ignore Ingress with only IngressClassName", func() {
invalidHost := "noclassforyou"
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, nil)
@ -666,6 +661,5 @@ var _ = framework.IngressNginxDescribe("[Flag] ingress-class", func() {
Expect().
Status(http.StatusNotFound)
})
})
})

View file

@ -21,6 +21,7 @@ import (
"strings"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
"k8s.io/ingress-nginx/test/e2e/framework"
)
@ -50,7 +51,6 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, `keepalive_requests 200;`)
})
})
})
@ -59,7 +59,8 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
f.UpdateNginxConfigMapData("upstream-keepalive-connections", "128")
f.WaitForNginxConfiguration(func(server string) bool {
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive 128;`, server)
match, err := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive 128;`, server)
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error matching the upstream keepalive time")
return match
})
})
@ -68,7 +69,8 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
f.UpdateNginxConfigMapData("upstream-keepalive-timeout", "120")
f.WaitForNginxConfiguration(func(server string) bool {
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_timeout\s*120s;`, server)
match, err := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_timeout\s*120s;`, server)
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error matching the upstream keepalive time")
return match
})
})
@ -77,7 +79,8 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
f.UpdateNginxConfigMapData("upstream-keepalive-time", "75s")
f.WaitForNginxConfiguration(func(server string) bool {
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_time\s*75s;`, server)
match, err := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_time\s*75s;`, server)
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error matching the upstream keepalive time")
return match
})
})
@ -86,7 +89,8 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
f.UpdateNginxConfigMapData("upstream-keepalive-requests", "200")
f.WaitForNginxConfiguration(func(server string) bool {
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_requests\s*200;`, server)
match, err := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_requests\s*200;`, server)
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error matching the upstream keepalive time")
return match
})
})

View file

@ -28,7 +28,6 @@ import (
)
var _ = framework.IngressNginxDescribe("[Flag] custom HTTP and HTTPS ports", func() {
host := "forwarded-headers"
f := framework.NewDefaultFramework("forwarded-port-headers", framework.WithHTTPBunEnabled())
@ -44,7 +43,6 @@ var _ = framework.IngressNginxDescribe("[Flag] custom HTTP and HTTPS ports", fun
ginkgo.Context("with a plain HTTP ingress", func() {
ginkgo.It("should set X-Forwarded-Port headers accordingly when listening on a non-default HTTP port", func() {
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
@ -64,9 +62,7 @@ var _ = framework.IngressNginxDescribe("[Flag] custom HTTP and HTTPS ports", fun
})
ginkgo.Context("with a TLS enabled ingress", func() {
ginkgo.It("should set X-Forwarded-Port header to 443", func() {
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
@ -94,7 +90,6 @@ var _ = framework.IngressNginxDescribe("[Flag] custom HTTP and HTTPS ports", fun
})
ginkgo.Context("when external authentication is configured", func() {
ginkgo.It("should set the X-Forwarded-Port header to 443", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-url": fmt.Sprintf("http://%s/basic-auth/user/password", f.HTTPBunIP),

View file

@ -36,7 +36,6 @@ var _ = framework.DescribeSetting("log-format-*", func() {
})
ginkgo.Context("Check log-format-escape-json and log-format-escape-none", func() {
ginkgo.It("should not configure log-format escape by default", func() {
f.WaitForNginxConfiguration(
func(cfg string) bool {
@ -78,7 +77,6 @@ var _ = framework.DescribeSetting("log-format-*", func() {
})
ginkgo.Context("Check log-format-upstream with log-format-escape-json and log-format-escape-none", func() {
ginkgo.It("log-format-escape-json enabled", func() {
f.SetNginxConfigMapData(map[string]string{
"log-format-escape-json": "true",

View file

@ -29,12 +29,12 @@ import (
var _ = framework.IngressNginxDescribeSerial("[Flag] watch namespace selector", func() {
f := framework.NewDefaultFramework("namespace-selector")
notMatchedHost, matchedHost := "bar", "foo"
notMatchedHost, matchedHost := barHost, fooHost
var notMatchedNs string
var matchedNs string
// create a test namespace, under which create an ingress and backend deployment
prepareTestIngress := func(baseName string, host string, labels map[string]string) string {
prepareTestIngress := func(host string, labels map[string]string) string {
ns, err := framework.CreateKubeNamespaceWithLabel(f.BaseName, labels, f.KubeClientSet)
assert.Nil(ginkgo.GinkgoT(), err, "creating test namespace")
f.NewEchoDeployment(framework.WithDeploymentNamespace(ns))
@ -49,8 +49,8 @@ var _ = framework.IngressNginxDescribeSerial("[Flag] watch namespace selector",
}
ginkgo.BeforeEach(func() {
notMatchedNs = prepareTestIngress(notMatchedHost, notMatchedHost, nil) // create namespace without label "foo=bar"
matchedNs = prepareTestIngress(matchedHost, matchedHost, map[string]string{"foo": "bar"})
notMatchedNs = prepareTestIngress(notMatchedHost, nil) // create namespace without label "foo=bar"
matchedNs = prepareTestIngress(matchedHost, map[string]string{fooHost: barHost})
})
ginkgo.AfterEach(func() {
@ -59,9 +59,7 @@ var _ = framework.IngressNginxDescribeSerial("[Flag] watch namespace selector",
})
ginkgo.Context("With specific watch-namespace-selector flags", func() {
ginkgo.It("should ingore Ingress of namespace without label foo=bar and accept those of namespace with label foo=bar", func() {
ginkgo.It("should ignore Ingress of namespace without label foo=bar and accept those of namespace with label foo=bar", func() {
f.WaitForNginxConfiguration(func(cfg string) bool {
return !strings.Contains(cfg, "server_name bar") &&
strings.Contains(cfg, "server_name foo")
@ -86,7 +84,7 @@ var _ = framework.IngressNginxDescribeSerial("[Flag] watch namespace selector",
if ns.Labels == nil {
ns.Labels = make(map[string]string)
}
ns.Labels["foo"] = "bar"
ns.Labels[fooHost] = barHost
_, err = f.KubeClientSet.CoreV1().Namespaces().Update(context.TODO(), ns, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "labeling not matched namespace")
@ -97,7 +95,7 @@ var _ = framework.IngressNginxDescribeSerial("[Flag] watch namespace selector",
if ing.Labels == nil {
ing.Labels = make(map[string]string)
}
ing.Labels["foo"] = "bar"
ing.Labels[fooHost] = barHost
_, err = f.KubeClientSet.NetworkingV1().Ingresses(notMatchedNs).Update(context.TODO(), ing, metav1.UpdateOptions{})
assert.Nil(ginkgo.GinkgoT(), err, "updating ingress")

View file

@ -18,12 +18,12 @@ package settings
import (
"fmt"
"golang.org/x/crypto/bcrypt"
"net/http"
"strings"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
"golang.org/x/crypto/bcrypt"
corev1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -34,7 +34,7 @@ var _ = framework.DescribeSetting("[Security] no-auth-locations", func() {
f := framework.NewDefaultFramework("no-auth-locations")
setting := "no-auth-locations"
username := "foo"
username := fooHost
password := "bar"
secretName := "test-secret"
host := "no-auth-locations"
@ -100,7 +100,8 @@ func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName s
ObjectMeta: metav1.ObjectMeta{
Name: host,
Namespace: namespace,
Annotations: map[string]string{"nginx.ingress.kubernetes.io/auth-type": "basic",
Annotations: map[string]string{
"nginx.ingress.kubernetes.io/auth-type": "basic",
"nginx.ingress.kubernetes.io/auth-secret": secretName,
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
},
@ -147,7 +148,6 @@ func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName s
}
func buildSecret(username, password, name, namespace string) *corev1.Secret {
//out, err := exec.Command("openssl", "passwd", "-crypt", password).CombinedOutput()
out, err := bcrypt.GenerateFromPassword([]byte(password), 14)
assert.Nil(ginkgo.GinkgoT(), err, "creating password")

View file

@ -44,6 +44,5 @@ var _ = framework.DescribeSetting("Add no tls redirect locations", func() {
f.WaitForNginxConfiguration(func(server string) bool {
return strings.Contains(server, "force_no_ssl_redirect = true,")
})
})
})

View file

@ -112,7 +112,7 @@ var _ = framework.DescribeSetting("OCSP", func() {
return strings.Contains(server, fmt.Sprintf(`server_name %v`, host))
})
tlsConfig := &tls.Config{ServerName: host, InsecureSkipVerify: true}
tlsConfig := &tls.Config{ServerName: host, InsecureSkipVerify: true} //nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(tlsConfig).
GET("/").
WithURL(f.GetURL(framework.HTTPS)).
@ -195,7 +195,8 @@ const configTemplate = `
func prepareCertificates(namespace string) error {
config := fmt.Sprintf(configTemplate, namespace)
err := os.WriteFile("cfssl_config.json", []byte(config), 0644)
//nolint:gosec // Not change permission to avoid possible issues
err := os.WriteFile("cfssl_config.json", []byte(config), 0o644)
if err != nil {
return fmt.Errorf("creating cfssl_config.json file: %v", err)
}

View file

@ -32,6 +32,8 @@ const (
opentelemetryLocationOperationName = "opentelemetry-location-operation-name"
opentelemetryConfig = "opentelemetry-config"
opentelemetryConfigPath = "/etc/nginx/opentelemetry.toml"
enable = "true"
)
var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
@ -46,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
ginkgo.It("should not exists opentelemetry directive", func() {
config := map[string]string{}
config[enableOpentelemetry] = "false"
config[enableOpentelemetry] = disable
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentelemetry, "/", enableOpentelemetry, f.Namespace, "http-svc", 80, nil))
@ -59,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
ginkgo.It("should exists opentelemetry directive when is enabled", func() {
config := map[string]string{}
config[enableOpentelemetry] = "true"
config[enableOpentelemetry] = enable
config[opentelemetryConfig] = opentelemetryConfigPath
f.SetNginxConfigMapData(config)
@ -73,9 +75,9 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
ginkgo.It("should include opentelemetry_trust_incoming_spans on directive when enabled", func() {
config := map[string]string{}
config[enableOpentelemetry] = "true"
config[enableOpentelemetry] = enable
config[opentelemetryConfig] = opentelemetryConfigPath
config[opentelemetryTrustIncomingSpan] = "true"
config[opentelemetryTrustIncomingSpan] = enable
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentelemetry, "/", enableOpentelemetry, f.Namespace, "http-svc", 80, nil))
@ -88,7 +90,7 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
ginkgo.It("should not exists opentelemetry_operation_name directive when is empty", func() {
config := map[string]string{}
config[enableOpentelemetry] = "true"
config[enableOpentelemetry] = enable
config[opentelemetryConfig] = opentelemetryConfigPath
config[opentelemetryOperationName] = ""
f.SetNginxConfigMapData(config)
@ -103,7 +105,7 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
ginkgo.It("should exists opentelemetry_operation_name directive when is configured", func() {
config := map[string]string{}
config[enableOpentelemetry] = "true"
config[enableOpentelemetry] = enable
config[opentelemetryConfig] = opentelemetryConfigPath
config[opentelemetryOperationName] = "HTTP $request_method $uri"
f.SetNginxConfigMapData(config)
@ -115,5 +117,4 @@ var _ = framework.IngressNginxDescribe("Configure Opentelemetry", func() {
return strings.Contains(cfg, `opentelemetry_operation_name "HTTP $request_method $uri"`)
})
})
})

View file

@ -41,8 +41,12 @@ const (
datadogCollectorHost = "datadog-collector-host"
opentracingOperationName = "opentracing-operation-name"
opentracingOperationName = "opentracing-operation-name"
opentracingOperationValue = "HTTP $request_method $uri"
opentracingLocationOperationName = "opentracing-location-operation-name"
localhost = "127.0.0.1"
)
var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
@ -57,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should not exists opentracing directive", func() {
config := map[string]string{}
config[enableOpentracing] = "false"
config[enableOpentracing] = disable
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentracing, "/", enableOpentracing, f.Namespace, "http-svc", 80, nil))
@ -70,8 +74,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should exists opentracing directive when is enabled", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentracing, "/", enableOpentracing, f.Namespace, "http-svc", 80, nil))
@ -84,9 +88,9 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should include opentracing_trust_incoming_span off directive when disabled", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[opentracingTrustIncomingSpan] = "false"
config[zipkinCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[opentracingTrustIncomingSpan] = disable
config[zipkinCollectorHost] = localhost
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentracing, "/", enableOpentracing, f.Namespace, "http-svc", 80, nil))
@ -99,8 +103,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should not exists opentracing_operation_name directive when is empty", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
config[opentracingOperationName] = ""
f.SetNginxConfigMapData(config)
@ -114,9 +118,9 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should exists opentracing_operation_name directive when is configured", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[opentracingOperationName] = "HTTP $request_method $uri"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
config[opentracingOperationName] = opentracingOperationValue
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentracing, "/", enableOpentracing, f.Namespace, "http-svc", 80, nil))
@ -129,8 +133,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should not exists opentracing_location_operation_name directive when is empty", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
config[opentracingLocationOperationName] = ""
f.SetNginxConfigMapData(config)
@ -144,9 +148,9 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should exists opentracing_location_operation_name directive when is configured", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[opentracingLocationOperationName] = "HTTP $request_method $uri"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
config[opentracingLocationOperationName] = opentracingOperationValue
f.SetNginxConfigMapData(config)
f.EnsureIngress(framework.NewSingleIngress(enableOpentracing, "/", enableOpentracing, f.Namespace, "http-svc", 80, nil))
@ -159,8 +163,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should enable opentracing using zipkin", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[zipkinCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[zipkinCollectorHost] = localhost
f.SetNginxConfigMapData(config)
framework.Sleep(10 * time.Second)
@ -171,8 +175,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should enable opentracing using jaeger", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[jaegerCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[jaegerCollectorHost] = localhost
f.SetNginxConfigMapData(config)
framework.Sleep(10 * time.Second)
@ -183,9 +187,9 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should enable opentracing using jaeger with sampler host", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[jaegerCollectorHost] = "127.0.0.1"
config[jaegerSamplerHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[jaegerCollectorHost] = localhost
config[jaegerSamplerHost] = localhost
f.SetNginxConfigMapData(config)
framework.Sleep(10 * time.Second)
@ -197,8 +201,8 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should propagate the w3c header when configured with jaeger", func() {
host := "jaeger-w3c"
config := map[string]string{}
config[enableOpentracing] = "true"
config[jaegerCollectorHost] = "127.0.0.1"
config[enableOpentracing] = enable
config[jaegerCollectorHost] = localhost
config[jaegerPropagationFormat] = "w3c"
f.SetNginxConfigMapData(config)
@ -227,7 +231,7 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
/*
ginkgo.It("should enable opentracing using jaeger with an HTTP endpoint", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[enableOpentracing] = TRUE
config[jaegerEndpoint] = "http://127.0.0.1/api/traces"
f.SetNginxConfigMapData(config)
@ -240,7 +244,7 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
ginkgo.It("should enable opentracing using datadog", func() {
config := map[string]string{}
config[enableOpentracing] = "true"
config[enableOpentracing] = enable
config[datadogCollectorHost] = "http://127.0.0.1"
f.SetNginxConfigMapData(config)

View file

@ -38,7 +38,6 @@ var _ = framework.IngressNginxDescribe("[Security] Pod Security Policies with vo
f := framework.NewDefaultFramework("pod-security-policies-volumes")
ginkgo.It("should be running with a Pod Security Policy", func() {
k8sversion, err := f.KubeClientSet.Discovery().ServerVersion()
if err != nil {
assert.Nil(ginkgo.GinkgoT(), err, "getting version")

View file

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:dupl // Ignore dupl errors for similar test case
package settings
import (
@ -64,5 +65,4 @@ var _ = framework.DescribeSetting("proxy-connect-timeout", func() {
return !strings.Contains(server, fmt.Sprintf("proxy_connect_timeout %ss;", proxyConnectTimeout))
})
})
})

View file

@ -33,8 +33,10 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const proxyProtocol = "proxy-protocol"
var _ = framework.DescribeSetting("use-proxy-protocol", func() {
f := framework.NewDefaultFramework("proxy-protocol")
f := framework.NewDefaultFramework(proxyProtocol)
setting := "use-proxy-protocol"
@ -42,9 +44,9 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
f.NewEchoDeployment()
f.UpdateNginxConfigMapData(setting, "false")
})
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should respect port passed by the PROXY Protocol", func() {
host := "proxy-protocol"
host := proxyProtocol
f.UpdateNginxConfigMapData(setting, "true")
@ -73,14 +75,15 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
body := string(data)
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=1234")
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=http")
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-for=192.168.0.1")
})
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should respect proto passed by the PROXY Protocol server port", func() {
host := "proxy-protocol"
host := proxyProtocol
f.UpdateNginxConfigMapData(setting, "true")
@ -109,14 +112,14 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
body := string(data)
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=443")
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=https")
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-for=192.168.0.1")
})
ginkgo.It("should enable PROXY Protocol for HTTPS", func() {
host := "proxy-protocol"
host := proxyProtocol
f.UpdateNginxConfigMapData(setting, "true")
@ -151,7 +154,7 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
body := string(data)
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=1234")
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=https")
assert.Contains(ginkgo.GinkgoT(), body, "x-scheme=https")

View file

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:dupl // Ignore dupl errors for similar test case
package settings
import (
@ -64,5 +65,4 @@ var _ = framework.DescribeSetting("proxy-read-timeout", func() {
return !strings.Contains(server, fmt.Sprintf("proxy_read_timeout %ss;", proxyReadtimeout))
})
})
})

View file

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:dupl // Ignore dupl errors for similar test case
package settings
import (
@ -64,5 +65,4 @@ var _ = framework.DescribeSetting("proxy-send-timeout", func() {
return !strings.Contains(server, fmt.Sprintf("proxy_send_timeout %ss;", proxySendTimeout))
})
})
})

View file

@ -19,7 +19,7 @@ package settings
import (
"context"
"crypto/tls"
"fmt"
"net"
"net/http"
"strings"
@ -54,7 +54,6 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
ginkgo.Describe("With enable-ssl-passthrough enabled", func() {
ginkgo.It("should enable ssl-passthrough-proxy-port on a different port", func() {
err := f.UpdateIngressControllerDeployment(func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--ssl-passthrough-proxy-port=1442")
@ -77,7 +76,6 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
})
ginkgo.It("should pass unknown traffic to default backend and handle known traffic", func() {
host := "testpassthrough.com"
echoName := "echopass"
@ -170,20 +168,21 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
return strings.Contains(server, "listen 442")
})
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
GET("/").
WithURL(fmt.Sprintf("https://%s:443", host)).
WithURL("https://"+net.JoinHostPort(host, "443")).
ForceResolve(f.GetNginxIP(), 443).
Expect().
Status(http.StatusOK)
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: hostBad, InsecureSkipVerify: true}).
GET("/").
WithURL(fmt.Sprintf("https://%s:443", hostBad)).
WithURL("https://"+net.JoinHostPort(hostBad, "443")).
ForceResolve(f.GetNginxIP(), 443).
Expect().
Status(http.StatusNotFound)
})
})
})

View file

@ -87,9 +87,7 @@ var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", f
})
ginkgo.Context("should configure HSTS policy header", func() {
var (
tlsConfig *tls.Config
)
var tlsConfig *tls.Config
const (
hstsMaxAge = "hsts-max-age"
@ -182,7 +180,6 @@ var _ = framework.DescribeSetting("[SSL] TLS protocols, ciphers and headers)", f
got := header["Strict-Transport-Security"]
assert.Equal(ginkgo.GinkgoT(), 1, len(got))
})
})
ginkgo.Context("ports or X-Forwarded-Host check during HTTP tp HTTPS redirection", func() {

View file

@ -29,7 +29,7 @@ import (
var _ = framework.IngressNginxDescribeSerial("annotation validations", func() {
f := framework.NewDefaultFramework("validations")
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should allow ingress based on their risk on webhooks", func() {
host := "annotation-validations"
@ -54,9 +54,8 @@ var _ = framework.IngressNginxDescribeSerial("annotation validations", func() {
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
_, err = f.KubeClientSet.NetworkingV1().Ingresses(f.Namespace).Update(context.TODO(), ing, metav1.UpdateOptions{})
assert.NotNil(ginkgo.GinkgoT(), err, "creating ingress with risky annotations should trigger an error")
})
//nolint:dupl // Ignore dupl errors for similar test case
ginkgo.It("should allow ingress based on their risk on webhooks", func() {
host := "annotation-validations"
@ -81,6 +80,5 @@ var _ = framework.IngressNginxDescribeSerial("annotation validations", func() {
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
_, err = f.KubeClientSet.NetworkingV1().Ingresses(f.Namespace).Update(context.TODO(), ing, metav1.UpdateOptions{})
assert.NotNil(ginkgo.GinkgoT(), err, "creating ingress with risky annotations should trigger an error")
})
})