Implement object deep inspector (#8456)
This commit is contained in:
parent
5737f16663
commit
89ed571d2a
15 changed files with 468 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ import (
|
|||
clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/ingress-nginx/internal/ingress/inspector"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/ingress-nginx/internal/file"
|
||||
|
|
@ -247,6 +248,7 @@ func New(
|
|||
client clientset.Interface,
|
||||
updateCh *channels.RingChannel,
|
||||
disableCatchAll bool,
|
||||
deepInspector bool,
|
||||
icConfig *ingressclass.IngressClassConfiguration) Storer {
|
||||
|
||||
store := &k8sStore{
|
||||
|
|
@ -426,6 +428,12 @@ func New(
|
|||
|
||||
klog.InfoS("Found valid IngressClass", "ingress", klog.KObj(ing), "ingressclass", ic)
|
||||
|
||||
if deepInspector {
|
||||
if err := inspector.DeepInspect(ing); err != nil {
|
||||
klog.ErrorS(err, "received invalid ingress", "ingress", klog.KObj(ing))
|
||||
return
|
||||
}
|
||||
}
|
||||
if hasCatchAllIngressRule(ing.Spec) && disableCatchAll {
|
||||
klog.InfoS("Ignoring add for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(ing))
|
||||
return
|
||||
|
|
@ -482,6 +490,13 @@ func New(
|
|||
return
|
||||
}
|
||||
|
||||
if deepInspector {
|
||||
if err := inspector.DeepInspect(curIng); err != nil {
|
||||
klog.ErrorS(err, "received invalid ingress", "ingress", klog.KObj(curIng))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
store.syncIngress(curIng)
|
||||
store.updateSecretIngressMap(curIng)
|
||||
store.syncSecrets(curIng)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue