Merge pull request #15584 from rook/mergify/bp/release-1.16/pr-15562
object: all CephBucketTopic reconcile errors set .status.phase (backport #15562)
This commit is contained in:
1 file changed
+2
-7
@@ -89,6 +89,7 @@ func (r *ReconcileBucketTopic) Reconcile(context context.Context, request reconc
|
||||
// workaround because the rook logging mechanism is not compatible with the controller-runtime logging interface
|
||||
reconcileResponse, err := r.reconcile(request)
|
||||
if err != nil {
|
||||
r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, k8sutil.ReconcileFailedStatus, nil)
|
||||
logger.Errorf("failed to reconcile %v", err)
|
||||
}
|
||||
|
||||
@@ -172,7 +173,6 @@ func (r *ReconcileBucketTopic) reconcile(request reconcile.Request) (reconcile.R
|
||||
// validate the topic settings
|
||||
err = cephBucketTopic.ValidateTopicSpec()
|
||||
if err != nil {
|
||||
r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, k8sutil.ReconcileFailedStatus, nil)
|
||||
return reconcile.Result{}, errors.Wrapf(err, "invalid CephBucketTopic %q", request.NamespacedName)
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ func (r *ReconcileBucketTopic) reconcile(request reconcile.Request) (reconcile.R
|
||||
// create topic
|
||||
topicARN, err := r.createCephBucketTopic(cephBucketTopic)
|
||||
if err != nil {
|
||||
return r.setFailedStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, "failed to create topic for bucket notifications", err)
|
||||
return reconcile.Result{}, errors.Wrapf(err, "topic creation failed for CephBucketTopic %q", request.NamespacedName)
|
||||
}
|
||||
|
||||
// update ObservedGeneration in status a the end of reconcile
|
||||
@@ -220,11 +220,6 @@ func (r *ReconcileBucketTopic) deleteCephBucketTopic(topic *cephv1.CephBucketTop
|
||||
)
|
||||
}
|
||||
|
||||
func (r *ReconcileBucketTopic) setFailedStatus(observedGeneration int64, name types.NamespacedName, errMessage string, err error) (reconcile.Result, error) {
|
||||
r.updateStatus(observedGeneration, name, k8sutil.ReconcileFailedStatus, nil)
|
||||
return reconcile.Result{}, errors.Wrapf(err, "%s", errMessage)
|
||||
}
|
||||
|
||||
// updateStatus updates the topic with a given status
|
||||
func (r *ReconcileBucketTopic) updateStatus(observedGeneration int64, nsName types.NamespacedName, status string, topicARN *string) {
|
||||
topic := &cephv1.CephBucketTopic{}
|
||||
|
||||
Reference in new issue
Block a user