Skip to content

PushSecret cannot be deleted after changing DeletionPolicy #3609

@lllamnyp

Description

@lllamnyp

Describe the bug
Creating a PushSecret with DeletionPolicy == Delete, then later updating DeletionPolicy to None makes the PushSecret undeleteable.

To Reproduce

  1. Create a PushSecret with DeletionPolicy == Delete.
  2. Update the DeletionPolicy to None.
  3. Attempt to delete the PushSecret.
  4. The finalizer is never removed so deletion never takes place.

Expected behavior
The PushSecret is removed (almost) immediately.

I'm quite sure that the cause of the bug is here and in other similar switch statements.

Basically, when a PushSecret is created/updated with DeletionPolicy==Delete, the controller adds a finalizer. When the DeletionPolicy is updated to None, the finalizer is not removed. Finally, when a PushSecret with a DeletionPolicy of None is deleted, there is no code path to remove the finalizer, merely an empty switch case. Hence, the PushSecret can never be removed without user intervention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions