Skip to content

Commit 950d6ce

Browse files
committed
chore(adoption): use debug level to log missing components
Use verbosity level 1 (debug) to log when a missing component is encountered during adoption. This reduces log noise in situations where the missing component is tolerable under normal operation; e.g. an InstallPlan referenced by a Subscription has been garbage collected. Signed-off-by: Nick Hale <[email protected]>
1 parent 58e9663 commit 950d6ce

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

cmd/olm/manager.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ import (
1010
"github.com/operator-framework/operator-lifecycle-manager/pkg/feature"
1111
)
1212

13-
var log = ctrl.Log.WithName("manager")
14-
1513
func Manager(ctx context.Context, debug bool) (ctrl.Manager, error) {
1614
ctrl.SetLogger(zap.New(zap.UseDevMode(debug)))
17-
setupLog := log.WithName("setup").V(4)
15+
setupLog := ctrl.Log.WithName("setup").V(1)
1816

1917
// Setup a Manager
2018
setupLog.Info("configuring manager")

pkg/controller/operators/adoption_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func NewAdoptionReconciler(cli client.Client, log logr.Logger, scheme *runtime.S
111111
func (r *AdoptionReconciler) ReconcileSubscription(ctx context.Context, req ctrl.Request) (reconcile.Result, error) {
112112
// Set up a convenient log object so we don't have to type request over and over again
113113
log := r.log.WithValues("request", req)
114-
log.V(4).Info("reconciling subscription")
114+
log.V(1).Info("reconciling subscription")
115115

116116
// Fetch the Subscription from the cache
117117
in := &operatorsv1alpha1.Subscription{}
@@ -173,7 +173,7 @@ func (r *AdoptionReconciler) ReconcileSubscription(ctx context.Context, req ctrl
173173
func (r *AdoptionReconciler) ReconcileClusterServiceVersion(ctx context.Context, req ctrl.Request) (reconcile.Result, error) {
174174
// Set up a convenient log object so we don't have to type request over and over again
175175
log := r.log.WithValues("request", req)
176-
log.V(4).Info("reconciling csv")
176+
log.V(1).Info("reconciling csv")
177177

178178
// Fetch the CSV from the cache
179179
in := &operatorsv1alpha1.ClusterServiceVersion{}
@@ -265,7 +265,7 @@ func (r *AdoptionReconciler) adopt(ctx context.Context, operator *decorators.Ope
265265

266266
if err := r.Get(ctx, types.NamespacedName{Namespace: m.GetNamespace(), Name: m.GetName()}, cObj); err != nil {
267267
if apierrors.IsNotFound(err) {
268-
r.log.Error(err, "component not found")
268+
r.log.V(1).Info("not found", "component", cObj)
269269
err = nil
270270
}
271271

@@ -307,7 +307,7 @@ func (r *AdoptionReconciler) disown(ctx context.Context, operator *decorators.Op
307307
}
308308

309309
// Only update if freshly disowned
310-
r.log.V(4).Info("component disowned", "component", candidate)
310+
r.log.V(1).Info("component disowned", "component", candidate)
311311
uCObj, ok := candidate.(client.Object)
312312
if !ok {
313313
return fmt.Errorf("Unable to typecast runtime.Object to client.Object")

0 commit comments

Comments
 (0)