Skip to content

Commit 31d72cc

Browse files
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.
1 parent dfd0b2b commit 31d72cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/controller/operators/labeller/filters.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"sync"
88

99
operators "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
10+
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
1011
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler"
1112
"github.com/sirupsen/logrus"
1213
"golang.org/x/sync/errgroup"
@@ -177,7 +178,12 @@ func Validate(ctx context.Context, logger *logrus.Logger, metadataClient metadat
177178
logger.WithFields(logrus.Fields{
178179
"gvr": gvr.String(),
179180
"nonconforming": count,
180-
}).Info("found nonconforming items")
181+
}).Errorf(
182+
"found nonconforming items: resource(s) are missing the %q label (metadata.labels[\"%s\"]=\"true\"). "+
183+
"You may want to consider deleting it (if this CRD is for an uninstalled solution) or labeling it appropriately.",
184+
install.OLMManagedLabelKey,
185+
install.OLMManagedLabelKey,
186+
)
181187
}
182188
okLock.Lock()
183189
ok = ok && count == 0

0 commit comments

Comments
 (0)