reject annotations with default prefix in the case of an override
This commit is contained in:
parent
f30a32a6e3
commit
9612180f6e
4 changed files with 28 additions and 3 deletions
|
|
@ -42,6 +42,7 @@ import (
|
|||
"k8s.io/ingress-nginx/internal/ingress"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/canary"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
|
||||
"k8s.io/ingress-nginx/internal/ingress/annotations/proxyssl"
|
||||
"k8s.io/ingress-nginx/internal/ingress/controller/config"
|
||||
ngx_config "k8s.io/ingress-nginx/internal/ingress/controller/config"
|
||||
|
|
@ -243,6 +244,18 @@ func TestCheckIngress(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
t.Run("When the default annotation prefix is used despite an override", func(t *testing.T) {
|
||||
parser.AnnotationsPrefix = "ingress.kubernetes.io"
|
||||
ing.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/backend-protocol"] = "GRPC"
|
||||
nginx.command = testNginxTestCommand{
|
||||
t: t,
|
||||
err: nil,
|
||||
}
|
||||
if nginx.CheckIngress(ing) == nil {
|
||||
t.Errorf("with a custom annotation prefix, ingresses using the default should be rejected")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("When the ingress is in a different namespace than the watched one", func(t *testing.T) {
|
||||
nginx.command = testNginxTestCommand{
|
||||
t: t,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue