Change enable-snippet to allow-snippet-annotation (#7670) (#7677)

Signed-off-by: Ricardo Pchevuzinske Katz <rkatz@vmware.com>
This commit is contained in:
Ricardo Katz 2021-09-20 23:28:23 -03:00 committed by GitHub
parent a104d4fbc3
commit bb265845b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 28 deletions

View file

@ -245,7 +245,7 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {
}
}
if !cfg.EnableSnippetDirectives && strings.HasSuffix(key, "-snippet") {
if !cfg.AllowSnippetAnnotations && strings.HasSuffix(key, "-snippet") {
return fmt.Errorf("%s annotation cannot be used. Snippet directives are disabled by the Ingress administrator", key)
}
@ -547,7 +547,7 @@ func (n *NGINXController) getBackendServers(ingresses []*ingress.Ingress) ([]*in
ingKey := k8s.MetaNamespaceKey(ing)
anns := ing.ParsedAnnotations
if !n.store.GetBackendConfiguration().EnableSnippetDirectives {
if !n.store.GetBackendConfiguration().AllowSnippetAnnotations {
dropSnippetDirectives(anns, ingKey)
}
@ -820,7 +820,7 @@ func (n *NGINXController) createUpstreams(data []*ingress.Ingress, du *ingress.B
anns := ing.ParsedAnnotations
ingKey := k8s.MetaNamespaceKey(ing)
if !n.store.GetBackendConfiguration().EnableSnippetDirectives {
if !n.store.GetBackendConfiguration().AllowSnippetAnnotations {
dropSnippetDirectives(anns, ingKey)
}
@ -1103,7 +1103,7 @@ func (n *NGINXController) createServers(data []*ingress.Ingress,
ingKey := k8s.MetaNamespaceKey(ing)
anns := ing.ParsedAnnotations
if !n.store.GetBackendConfiguration().EnableSnippetDirectives {
if !n.store.GetBackendConfiguration().AllowSnippetAnnotations {
dropSnippetDirectives(anns, ingKey)
}
@ -1183,7 +1183,7 @@ func (n *NGINXController) createServers(data []*ingress.Ingress,
ingKey := k8s.MetaNamespaceKey(ing)
anns := ing.ParsedAnnotations
if !n.store.GetBackendConfiguration().EnableSnippetDirectives {
if !n.store.GetBackendConfiguration().AllowSnippetAnnotations {
dropSnippetDirectives(anns, ingKey)
}