From 8ea6b93ab4c3bfa9a902ca2c986ae0e4924ef433 Mon Sep 17 00:00:00 2001 From: Luca Burgazzoli Date: Tue, 23 Aug 2022 13:29:53 +0200 Subject: [PATCH] feat(must gather): add debug logging --- rhoc/pkg/util/kubernetes/client.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rhoc/pkg/util/kubernetes/client.go b/rhoc/pkg/util/kubernetes/client.go index da0d907..2b8bfbf 100644 --- a/rhoc/pkg/util/kubernetes/client.go +++ b/rhoc/pkg/util/kubernetes/client.go @@ -90,20 +90,22 @@ func (in *Client) List(resources []schema.GroupVersionResource, options metav1.L } resList, err := dc.Resource(gvr).List(in.f.Context, options) - if err != nil { switch { case kerr.IsUnauthorized(err): - in.f.Logger.Errorf("Unauthorized access to %s:%s", gvr.GroupVersion(), gvr.Resource) + in.f.Logger.Debugf("unauthorized access to %s:%s", gvr.GroupVersion(), gvr.Resource) continue case kerr.IsForbidden(err): - in.f.Logger.Errorf("Forbidden access to %s:%s", gvr.GroupVersion(), gvr.Resource) + in.f.Logger.Debugf("forbidden access to %s:%s", gvr.GroupVersion(), gvr.Resource) continue default: + in.f.Logger.Debugf("error listing %s:%s, %s", gvr.GroupVersion(), gvr.Resource, err.Error()) return nil, err } } + in.f.Logger.Debugf("found %d %s:%s resources", len(resList.Items), gvr.GroupVersion(), gvr.Resource) + for i := range resList.Items { // remove managed fields as they are only making noise resList.Items[i].SetManagedFields(nil)