From 49cf02ee6d89c46db8b080bee4feb548cc84f553 Mon Sep 17 00:00:00 2001 From: Jose Luis Segura Lucas Date: Thu, 5 Dec 2024 07:49:56 +0100 Subject: [PATCH] OCPBUGS-45047: Avoid to send the same error repeated N times (#1043) * Avoid to send the same error repeated N times * Fix the LokiStack gatherer documentation --- docs/gathered-data.md | 9 +++++---- pkg/gatherers/clusterconfig/gather_lokistack.go | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/gathered-data.md b/docs/gathered-data.md index 4ab8354b0..c380c632f 100644 --- a/docs/gathered-data.md +++ b/docs/gathered-data.md @@ -1066,15 +1066,15 @@ None Collects `lokistacks.loki.grafana.com` resources. -The gatherer will collect up to 20 resources from `openshift-logging` namespace +The gatherer will collect up to 20 resources from `openshift-*` namespaces and it will report errors if it finds a `LokiStack` resource in a different namespace -or if there are more than 20 `LokiStacks` in the `openshift-logging` namespace. +or if there are more than 20 `LokiStacks` in the `openshift-*` namespaces. ### API Reference None ### Sample data -- [docs/insights-archive-sample/namespaces/openshift-logging/.json](./insights-archive-sample/namespaces/openshift-logging/.json) +- [docs/insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json](./insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json) ### Location in archive - `namespace/{namespace}/loki.grafana.com/lokistacks/{name}.json` @@ -1083,7 +1083,7 @@ None `clusterconfig/lokistacks ### Released version -- 4.18.0 +- 4.19.0 ### Backported versions None @@ -2365,5 +2365,6 @@ None ### Changes - Image repository is now collected if it comes from outside the Red Hat domain +- [Tech Preview] runtime info for workloads are collected (since 4.18.0) diff --git a/pkg/gatherers/clusterconfig/gather_lokistack.go b/pkg/gatherers/clusterconfig/gather_lokistack.go index e83bafeb0..ff70c28cf 100644 --- a/pkg/gatherers/clusterconfig/gather_lokistack.go +++ b/pkg/gatherers/clusterconfig/gather_lokistack.go @@ -21,24 +21,24 @@ const lokiStackResourceLimit = 20 // GatherLokiStack Collects `lokistacks.loki.grafana.com` resources. // -// The gatherer will collect up to 20 resources from `openshift-logging` namespace +// The gatherer will collect up to 20 resources from `openshift-*` namespaces // and it will report errors if it finds a `LokiStack` resource in a different namespace -// or if there are more than 20 `LokiStacks` in the `openshift-logging` namespace. +// or if there are more than 20 `LokiStacks` in the `openshift-*` namespaces. // // ### API Reference // None // // ### Sample data -// - docs/insights-archive-sample/namespaces/openshift-logging/.json +// - docs/insights-archive-sample/namespaces/openshift-logging/lokistack-sample.json // // ### Location in archive -// - `namespace/openshift-logging/loki.grafana.com/lokistacks/{name}.json` +// - `namespace/{namespace}/loki.grafana.com/lokistacks/{name}.json` // // ### Config ID // `clusterconfig/lokistacks // // ### Released version -// - 4.18.0 +// - 4.19.0 // // ### Backported versions // None @@ -87,6 +87,7 @@ func gatherLokiStack(ctx context.Context, dynamicClient dynamic.Interface) ([]re if len(records) >= lokiStackResourceLimit { if !tooManyResourcesError { + tooManyResourcesError = true errs = append(errs, fmt.Errorf( "found %d resources, limit (%d) reached", len(loggingResourceList.Items), lokiStackResourceLimit),