From f49d2fdb3b6f3b056da4cc9d3fa0b6711e897432 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Mon, 9 Nov 2020 08:48:50 -0300 Subject: [PATCH] Improve class.IsValid logs --- go.mod | 1 + go.sum | 2 ++ internal/ingress/controller/store/store.go | 7 +++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 2d440c98b..a08f1c1a0 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( k8s.io/code-generator v0.19.3 k8s.io/component-base v0.19.3 k8s.io/klog/v2 v2.3.0 + k8s.io/utils v0.0.0-20201104234853-8146046b121e pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 sigs.k8s.io/controller-runtime v0.6.1-0.20200925153312-fdc6658a141b ) diff --git a/go.sum b/go.sum index 8dc1f9210..d588619d5 100644 --- a/go.sum +++ b/go.sum @@ -1001,6 +1001,8 @@ k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K8Hf8whTseBgJcg= k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20201104234853-8146046b121e h1:dUhh0zO/94tOe9DB05HFGE69ofectI1PBCmIxO612MI= +k8s.io/utils v0.0.0-20201104234853-8146046b121e/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e h1:C7q+e9M5nggAvWfVg9Nl66kebKeuJlP3FD58V4RR5wo= moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e/go.mod h1:nejbQVfXh96n9dSF6cH3Jsk/QI1Z2oEL7sSI2ifXFNA= pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 h1:SAElp8THCfmBdM+4lmWX5gebiSSkEr7PAYDVF91qpfg= diff --git a/internal/ingress/controller/store/store.go b/internal/ingress/controller/store/store.go index 814142a3d..1e36d6cc2 100644 --- a/internal/ingress/controller/store/store.go +++ b/internal/ingress/controller/store/store.go @@ -41,6 +41,7 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" + "k8s.io/utils/pointer" "k8s.io/ingress-nginx/internal/file" "k8s.io/ingress-nginx/internal/ingress" @@ -347,14 +348,16 @@ func New( AddFunc: func(obj interface{}) { ing, _ := toIngress(obj) if !class.IsValid(ing) { - a, _ := parser.GetStringAnnotation(class.IngressKey, ing) - klog.InfoS("Ignoring add for ingress based on annotation", "ingress", klog.KObj(ing), "annotation", a) + ingressClass, _ := parser.GetStringAnnotation(class.IngressKey, ing) + klog.InfoS("Ignoring ingress", "ingress", klog.KObj(ing), "kubernetes.io/ingress.class", ingressClass, "ingressClassName", pointer.StringPtrDerefOr(ing.Spec.IngressClassName, "")) return } + if isCatchAllIngress(ing.Spec) && disableCatchAll { klog.InfoS("Ignoring add for catch-all ingress because of --disable-catch-all", "ingress", klog.KObj(ing)) return } + recorder.Eventf(ing, corev1.EventTypeNormal, "Sync", "Scheduled for sync") store.syncIngress(ing)