From 24a34a9aca205a14a00a20a87ef1312784264db2 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Thu, 24 Apr 2025 11:06:44 +0100 Subject: [PATCH] fix(olm): improve error logging for missing olm.managed label Previously, nonconforming CRDs (missing the label) were logged as INFO, but this caused the to enter a CrashLoopBackOff state due to unhandled inconsistencies. This commit raises the log level to and enhances the message with actionable advice, clarifying that users should either delete CRDs for uninstalled solutions or label them appropriately. The root cause of the scenario is: From an old release (ocp 4.15) the component managed by OLM should have the label olm.managed: true added to comply with the new checks. --- pkg/controller/operators/labeller/filters.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/controller/operators/labeller/filters.go b/pkg/controller/operators/labeller/filters.go index 333bc2b9ea..c07545ae99 100644 --- a/pkg/controller/operators/labeller/filters.go +++ b/pkg/controller/operators/labeller/filters.go @@ -7,6 +7,7 @@ import ( "sync" operators "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned" + "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install" "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" @@ -177,7 +178,11 @@ func Validate(ctx context.Context, logger *logrus.Logger, metadataClient metadat logger.WithFields(logrus.Fields{ "gvr": gvr.String(), "nonconforming": count, - }).Info("found nonconforming items") + }).Errorf( + "found nonconforming items: missing the the required label %q (metadata.labels[\"%s\"]=\"true\"). ", + install.OLMManagedLabelKey, + install.OLMManagedLabelKey, + ) } okLock.Lock() ok = ok && count == 0