From d67b44212afafc506c97009c9f26369f0e150a86 Mon Sep 17 00:00:00 2001 From: Jussi Nummelin Date: Thu, 16 May 2024 15:18:04 +0200 Subject: [PATCH] Fix error handling in EtcdMemberReconciler The watch for CRD getting ready used wrong error when checking if it is retriable. This results in bogus logging and a "busyloop": ``` time="2024-05-16 10:05:45" level=info msg="Transient error while watching etcdmember CRD, last observed version is \"\", starting over after 0s ..." component=etcdMemberReconciler error="" time="2024-05-16 10:05:45" level=info msg="Transient error while watching etcdmember CRD, last observed version is \"\", starting over after 0s ..." component=etcdMemberReconciler error="" time="2024-05-16 10:05:45" level=info msg="Transient error while watching etcdmember CRD, last observed version is \"\", starting over after 0s ..." component=etcdMemberReconciler error="" ... ``` It actually hides the transient errors encountered. Signed-off-by: Jussi Nummelin --- pkg/component/controller/etcd_member_reconciler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/component/controller/etcd_member_reconciler.go b/pkg/component/controller/etcd_member_reconciler.go index 0b056dda6e4d..ea384017c055 100644 --- a/pkg/component/controller/etcd_member_reconciler.go +++ b/pkg/component/controller/etcd_member_reconciler.go @@ -142,7 +142,7 @@ func (e *EtcdMemberReconciler) waitForCRD(ctx context.Context) error { log.Info("waiting to see EtcdMember CRD ready") return watch.FromClient[*crdList, crd](ec.CustomResourceDefinitions()). WithObjectName(fmt.Sprintf("%s.%s", "etcdmembers", "etcd.k0sproject.io")). - WithErrorCallback(func(cbErr error) (retryDelay time.Duration, err error) { + WithErrorCallback(func(err error) (time.Duration, error) { if retryAfter, e := watch.IsRetryable(err); e == nil { log.WithError(err).Infof( "Transient error while watching etcdmember CRD"+