From 3a8e2faf0a6b14cb88f84e1ea9ba2ff729eb4eff Mon Sep 17 00:00:00 2001 From: Evan Mahoney <16479213+emmahone@users.noreply.github.com> Date: Mon, 20 Jul 2026 17:51:44 -0400 Subject: [PATCH] reconciler: fix inverted log message and level for UpdateNotReadyErr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ensureUpdatePod returns UpdateNotReadyErr (the expected, benign signal that a new update pod has not yet reported ready), EnsureRegistryServer logged the error at level=error with the message "ensure update pod error is not of type UpdateNotReadyErr" — the exact opposite of what happened. The ok branch fires precisely when the error IS UpdateNotReadyErr, so the message was backwards. Additionally, logging a normal pod-startup wait at error level contributed to spurious error floods in environments where registry pods have long startup times. This commit: - Checks for UpdateNotReadyErr before the generic error log, so the benign case never fires at level=error. - Corrects the log message to "update pod not yet ready". - Downgrades the log to Debug, since this is an expected polling state. - Adds a regression unit test verifying EnsureRegistryServer returns UpdateNotReadyErr (unmodified) when a not-ready update pod is present. --- pkg/controller/registry/reconciler/grpc.go | 4 +-- .../registry/reconciler/grpc_test.go | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/pkg/controller/registry/reconciler/grpc.go b/pkg/controller/registry/reconciler/grpc.go index 024e298691..9def285d4e 100644 --- a/pkg/controller/registry/reconciler/grpc.go +++ b/pkg/controller/registry/reconciler/grpc.go @@ -340,11 +340,11 @@ func (c *GrpcRegistryReconciler) EnsureRegistryServer(logger *logrus.Entry, cata return pkgerrors.Wrapf(err, "error ensuring pod: %s", pod.GetName()) } if err := c.ensureUpdatePod(logger, sa, defaultPodSecurityConfig, source); err != nil { - logger.WithError(err).Error("error ensuring registry server: could not ensure update pod") if _, ok := err.(UpdateNotReadyErr); ok { - logger.WithError(err).Error("error ensuring registry server: ensure update pod error is not of type UpdateNotReadyErr") + logger.WithError(err).Debug("error ensuring registry server: update pod not yet ready") return err } + logger.WithError(err).Error("error ensuring registry server: could not ensure update pod") return pkgerrors.Wrapf(err, "error ensuring updated catalog source pod: %s", pod.GetName()) } diff --git a/pkg/controller/registry/reconciler/grpc_test.go b/pkg/controller/registry/reconciler/grpc_test.go index d528ea5b90..89b1719ce0 100644 --- a/pkg/controller/registry/reconciler/grpc_test.go +++ b/pkg/controller/registry/reconciler/grpc_test.go @@ -64,6 +64,16 @@ func grpcCatalogSourceWithAnnotations(annotations map[string]string) *v1alpha1.C return catsrc } +func grpcCatalogSourceWithPolling() *v1alpha1.CatalogSource { + catsrc := validGrpcCatalogSource("image", "") + catsrc.Spec.UpdateStrategy = &v1alpha1.UpdateStrategy{ + RegistryPoll: &v1alpha1.RegistryPoll{ + Interval: &metav1.Duration{Duration: 1 * time.Minute}, + }, + } + return catsrc +} + func grpcCatalogSourceWithName(name string) *v1alpha1.CatalogSource { catsrc := validGrpcCatalogSource("image", "") catsrc.SetName(name) @@ -387,6 +397,28 @@ func TestGrpcRegistryReconciler(t *testing.T) { }, }, }, + { + testName: "Grpc/PollingEnabled/UpdatePodNotReady/ReturnsUpdateNotReadyErr", + in: in{ + cluster: cluster{ + k8sObjs: append( + objectsForCatalogSource(t, grpcCatalogSourceWithPolling()), + &corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: "update-pod", + Namespace: testNamespace, + Labels: map[string]string{CatalogSourceUpdateKey: "img-catalog"}, + }, + Status: corev1.PodStatus{Phase: corev1.PodRunning}, + }, + ), + }, + catsrc: grpcCatalogSourceWithPolling(), + }, + out: out{ + err: UpdateNotReadyErr{catalogName: "img-catalog", podName: "update-pod"}, + }, + }, } for _, tt := range tests { t.Run(tt.testName, func(t *testing.T) {