mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
Do not log error when resource is not namespaced (#2730)
Signed-off-by: Jose Armesto <github@armesto.net>
This commit is contained in:
parent
f90b982903
commit
1ff16ba5d4
2 changed files with 2 additions and 2 deletions
|
@ -53,7 +53,7 @@ func GetNamespaceSelectorsFromGenericInformer(kind, namespaceOfResource string,
|
|||
// GetNamespaceSelectorsFromNamespaceLister - extract the namespacelabels when namespace lister is passed
|
||||
func GetNamespaceSelectorsFromNamespaceLister(kind, namespaceOfResource string, nsLister listerv1.NamespaceLister, logger logr.Logger) map[string]string {
|
||||
namespaceLabels := make(map[string]string)
|
||||
if kind != "Namespace" {
|
||||
if kind != "Namespace" && namespaceOfResource != "" {
|
||||
namespaceObj, err := nsLister.Get(namespaceOfResource)
|
||||
if err != nil {
|
||||
log.Log.Error(err, "failed to get the namespace", "name", namespaceOfResource)
|
||||
|
|
|
@ -172,7 +172,7 @@ func (pc *PolicyController) getResourceList(kind, namespace string, labelSelecto
|
|||
|
||||
resourceList, err := pc.client.ListResource("", kind, namespace, labelSelector)
|
||||
if err != nil {
|
||||
log.Error(err, "failed to list resources", "kind")
|
||||
log.Error(err, "failed to list resources", "kind", kind, "namespace", namespace)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue