Skip to content

Commit

Permalink
Only log get error if not "not found"
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCao committed Oct 18, 2024
1 parent 1ff72d4 commit f1d5622
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/controller/lease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

jumpstarterdevv1alpha1 "github.com/jumpstarter-dev/jumpstarter-controller/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -57,7 +58,9 @@ func (r *LeaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl

var lease jumpstarterdevv1alpha1.Lease
if err := r.Get(ctx, req.NamespacedName, &lease); err != nil {
logger.Error(err, "Reconcile: unable to get lease", "lease", req.NamespacedName)
if !apierrors.IsNotFound(err) {
logger.Error(err, "Reconcile: unable to get lease", "lease", req.NamespacedName)
}
return ctrl.Result{}, client.IgnoreNotFound(err)
}

Expand Down

0 comments on commit f1d5622

Please sign in to comment.