Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/controller/registry/reconciler/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
32 changes: 32 additions & 0 deletions pkg/controller/registry/reconciler/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down