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) {