Ensure webhook validation ingress has a PathTypePrefix

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-04-27 07:03:07 -04:00
parent bae9043171
commit dbaefc8ee9
3 changed files with 25 additions and 17 deletions

View file

@ -26,6 +26,7 @@ import (
"github.com/mitchellh/hashstructure"
apiv1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1beta1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
@ -219,6 +220,8 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {
toCheck.ObjectMeta.Name == ing.ObjectMeta.Name
}
k8s.SetDefaultPathTypeIfEmpty(ing)
ings := n.store.ListIngresses(filter)
ings = append(ings, &ingress.Ingress{
Ingress: *ing,
@ -529,7 +532,7 @@ func (n *NGINXController) getBackendServers(ingresses []*ingress.Ingress) ([]*in
if loc.Path == nginxPath {
// Same paths but different types are allowed
// (same type means overlap in the path definition)
if *loc.PathType != *path.PathType {
if !apiequality.Semantic.DeepEqual(loc.PathType, path.PathType) {
break
}