Deny catch-all ingress when DisableCatchAll is set

This commit is contained in:
Mahnoor Mehboob 2021-04-24 11:49:45 -04:00
parent 2503b23b09
commit 8f7fecab17
2 changed files with 26 additions and 0 deletions

View file

@ -224,6 +224,10 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {
return nil
}
if n.cfg.DisableCatchAll && ing.Spec.Backend != nil {
return fmt.Errorf("This deployment is trying to create a catch-all ingress while DisableCatchAll flag is set to true. Remove '.spec.backend' or set DisableCatchAll flag to false.")
}
if parser.AnnotationsPrefix != parser.DefaultAnnotationsPrefix {
for key := range ing.ObjectMeta.GetAnnotations() {
if strings.HasPrefix(key, fmt.Sprintf("%s/", parser.DefaultAnnotationsPrefix)) {