Skip to content

Improve removal of storage-encryption-secret finalizer #604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion controllers/postgres_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func (r *PostgresReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c

if err := r.removeStorageEncryptionSecretFinalizer(log, ctx, instance); err != nil {
log.Error(err, "error while remnoving finalizer from storage encryption secret")
// this would be blocking if we couldn't remove the finalizer, so we should keep trying!
return ctrl.Result{}, err
} else {
log.V(debugLogLevel).Info("finalizer from storage encryption secret removed")
}
Expand Down Expand Up @@ -1833,7 +1835,11 @@ func (r *PostgresReconciler) removeStorageEncryptionSecretFinalizer(log logr.Log
log.V(debugLogLevel).Info("Fetching storage secret", "name", n)
err := r.SvcClient.Get(ctx, types.NamespacedName{Namespace: ns, Name: n}, s)
if err != nil {
// TODO this would be blocking if we couldn't remove the finalizer!
if apierrors.IsNotFound(err) {
log.V(debugLogLevel).Info("storage secret not found, nothing to do", "name", n)
return nil
}
// this would be blocking if we couldn't remove the finalizer, so we should keep trying!
return fmt.Errorf("error while fetching storage secret from service cluster: %w", err)
}

Expand Down