From 777fd55bf5d8a974c64215ab53ab892970f170e3 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:18:53 +0100 Subject: [PATCH] fix(olm): improve error logging for missing olm.managed label (#3558) 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. Upstream-repository: operator-lifecycle-manager Upstream-commit: 1d9eafd4278ec97ea4caa1b6d56d5f901d550374 --- .../pkg/controller/operators/labeller/filters.go | 7 ++++++- .../pkg/controller/operators/labeller/filters.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go b/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go index 333bc2b9ea..c07545ae99 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go +++ b/staging/operator-lifecycle-manager/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 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go index 333bc2b9ea..c07545ae99 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/labeller/filters.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/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