update catch-all ingress requirement logic

This commit is contained in:
Mahnoor Mehboob 2021-04-21 17:49:58 -04:00
parent f5cfd5730c
commit cc4d5f2283

View file

@ -328,7 +328,7 @@ func New(
return
}
if isCatchAllIngress(ing.Spec) && disableCatchAll {
if hasCatchAllIngress(ing.Spec) && disableCatchAll {
klog.InfoS("Ignoring delete for catch-all because of --disable-catch-all", "ingress", klog.KObj(ing))
return
}
@ -353,7 +353,7 @@ func New(
return
}
if isCatchAllIngress(ing.Spec) && disableCatchAll {
if hasCatchAllIngress(ing.Spec) && disableCatchAll {
klog.InfoS("Ignoring add for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(ing))
return
}
@ -377,7 +377,7 @@ func New(
validOld := class.IsValid(oldIng)
validCur := class.IsValid(curIng)
if !validOld && validCur {
if isCatchAllIngress(curIng.Spec) && disableCatchAll {
if hasCatchAllIngress(curIng.Spec) && disableCatchAll {
klog.InfoS("ignoring update for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(curIng))
return
}
@ -389,7 +389,7 @@ func New(
ingDeleteHandler(old)
return
} else if validCur && !reflect.DeepEqual(old, cur) {
if isCatchAllIngress(curIng.Spec) && disableCatchAll {
if hasCatchAllIngress(curIng.Spec) && disableCatchAll {
klog.InfoS("ignoring update for catch-all ingress and delete old one because of --disable-catch-all", "ingress", klog.KObj(curIng))
ingDeleteHandler(old)
return
@ -624,10 +624,10 @@ func New(
return store
}
// isCatchAllIngress returns whether or not an ingress produces a
// hasCatchAllIngress returns whether or not an ingress produces a
// catch-all server, and so should be ignored when --disable-catch-all is set
func isCatchAllIngress(spec networkingv1beta1.IngressSpec) bool {
return spec.Backend != nil && len(spec.Rules) == 0
func hasCatchAllIngress(spec networkingv1beta1.IngressSpec) bool {
return spec.Backend != nil
}
// syncIngress parses ingress annotations converting the value of the