Skip to content

Commit

Permalink
No need to patch in patching reconciler
Browse files Browse the repository at this point in the history
Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
  • Loading branch information
danail-branekov and georgethebeatle committed May 31, 2023
1 parent 2549b57 commit 3dda88f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions controllers/controllers/workloads/cfpackage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package workloads

import (
"context"
"fmt"

korifiv1alpha1 "code.cloudfoundry.org/korifi/controllers/api/v1alpha1"
"code.cloudfoundry.org/korifi/controllers/controllers/shared"
Expand Down Expand Up @@ -164,14 +163,8 @@ func (r *CFPackageReconciler) finalize(ctx context.Context, log logr.Logger, cfP
}
}

err := k8s.Patch(ctx, r.k8sClient, cfPackage, func() {
if controllerutil.RemoveFinalizer(cfPackage, cfPackageFinalizer) {
log.V(1).Info("finalizer removed")
}
})
if err != nil {
r.log.Info("failed to patch package", "reason", err)
return ctrl.Result{}, fmt.Errorf("failed to patch package: %w", err)
if controllerutil.RemoveFinalizer(cfPackage, cfPackageFinalizer) {
log.V(1).Info("finalizer removed")
}

return ctrl.Result{}, nil
Expand Down

0 comments on commit 3dda88f

Please sign in to comment.