Remove hard-coded annotation and don't use map pointers
This commit is contained in:
parent
c2550930b1
commit
5c30820d1f
43 changed files with 179 additions and 173 deletions
|
|
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
|||
"nginx.ingress.kubernetes.io/configuration-snippet": configSnippet,
|
||||
}
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(cfg string) bool {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Global External Auth", func() {
|
|||
annotations := map[string]string{
|
||||
enableGlobalExternalAuthAnnotation: "false",
|
||||
}
|
||||
barIng := framework.NewSingleIngress("bar-ingress", barPath, host, f.Namespace, echoServiceName, 80, &annotations)
|
||||
barIng := framework.NewSingleIngress("bar-ingress", barPath, host, f.Namespace, echoServiceName, 80, annotations)
|
||||
f.EnsureIngress(barIng)
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import (
|
|||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/class"
|
||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
)
|
||||
|
||||
|
|
@ -44,9 +45,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
It("should ignore Ingress with class", func() {
|
||||
invalidHost := "foo"
|
||||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
class.IngressKey: "testclass",
|
||||
}
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, &annotations)
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
validHost := "bar"
|
||||
|
|
@ -76,7 +77,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
|
||||
Context("With a specific ingress-class", func() {
|
||||
BeforeEach(func() {
|
||||
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
func(deployment *appsv1.Deployment) error {
|
||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||
args = append(args, "--ingress-class=testclass")
|
||||
|
|
@ -85,6 +86,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
|
||||
return err
|
||||
})
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
|
||||
It("should ignore Ingress with no class", func() {
|
||||
|
|
@ -95,9 +97,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
|
||||
validHost := "foo"
|
||||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
class.IngressKey: "testclass",
|
||||
}
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, framework.EchoService, 80, &annotations)
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(validHost, func(cfg string) bool {
|
||||
|
|
@ -126,10 +128,10 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
It("should delete Ingress when class is removed", func() {
|
||||
host := "foo"
|
||||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
class.IngressKey: "testclass",
|
||||
}
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
|
||||
ing = f.EnsureIngress(ing)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||
return strings.Contains(cfg, "server_name foo")
|
||||
|
|
@ -145,8 +147,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
delete(ing.Annotations, "kubernetes.io/ingress.class")
|
||||
f.EnsureIngress(ing)
|
||||
delete(ing.Annotations, class.IngressKey)
|
||||
_, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(ing.Namespace).Update(ing)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||
return !strings.Contains(cfg, "server_name foo")
|
||||
|
|
@ -160,5 +163,4 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Listen on nondefault ports", func() {
|
|||
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
|
||||
}
|
||||
|
||||
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
|
||||
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
|
||||
|
||||
f.EnsureIngress(ing)
|
||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||
}
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(server string) bool {
|
||||
|
|
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
"nginx.ingress.kubernetes.io/upstream-vhost": upstreamVHost,
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||
}
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(server string) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue