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