Skip to content

Allow deleting paused PackageRepositories - #1878

Open
NopeCharon wants to merge 1 commit into
carvel-dev:developfrom
NopeCharon:allow-deleting-paused-pkgr
Open

NopeCharon wants to merge 1 commit into
carvel-dev:developfrom
NopeCharon:allow-deleting-paused-pkgr

Conversation

@NopeCharon

Copy link
Copy Markdown

What this PR does / why we need it:

A PackageRepository with spec.paused: true cannot be deleted. The PackageRepository reconciler checks spec.paused before it checks for a deletion timestamp. So when a paused repository is being deleted, the reconciler only refreshes its status and never removes the finalizer. Clients such as kapp then wait forever for the resource to go away.

This PR checks for the deletion timestamp first, so deletion proceeds whether or not the repository is paused. The App reconciler already uses this order (#568), which is why paused Apps and PackageInstalls can be deleted.

Which issue(s) this PR fixes:

Fixes #898

Does this PR introduce a user-facing change?

Paused PackageRepositories can now be deleted without having to be unpaused first.

Additional Notes for your reviewer:

Added TestPausedPackageRepositoryIsDeleted. It reconciles a paused PackageRepository that is marked for deletion and checks that its finalizer is removed. The test fails without the fix (the finalizer remains) and passes with it.

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


A PackageRepository with `spec.paused: true` could not be deleted: the
reconciler checked for the paused state before checking for a deletion
timestamp, so a paused repository being deleted only ever had its status
refreshed and its finalizer was never removed. Clients such as kapp then
blocked forever waiting for the resource to go away.

Check for a deletion timestamp first so that deletion proceeds regardless
of the paused state. This mirrors the ordering used by the App reconciler,
which already allows paused Apps (and therefore paused PackageInstalls) to
be deleted.

Add a unit test that reconciles a paused PackageRepository marked for
deletion and asserts that its finalizer is removed.

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

When package repository is paused cannot be deleted

2 participants