zalando / zalando/postgres-operator

When using finalizers, delete protection via annotation is ignored

Open
#2,918 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

  • Which image of the operator are you using? e.g. ghcr.io/zalando/postgres-operator:v1.13.0
    ghcr.io/zalando/postgres-operator:v1.14.0
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? [AWS K8s | GCP ... | Bare Metal K8s]
    GCP
  • Are you running Postgres Operator in production? [yes | no]
    Not yet
  • Type of issue? [Bug report, question, feature request, etc.]
    Bug report

When using finalizers, the operator deletes all resources before the EventDelete event is received.
The delete protection check occurs when the EventDelete event is added to the queue, but by then all the resources have been deleted.

When the operator notices the DeleteTimestamp is set here, it proceeds to delete the cluster right away.
It might be better at that point to simply queue an EventDelete event to handle the deletion the normal way (assuming I've understood the internal event system correctly).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/controller/postgresql.go at the DeleteTimestamp handling around line 334, then trace how EventDelete is queued and where the annotation-based delete protection is checked. Confirm the finalizer path and event flow with the existing controller tests, if present. Done means delete protection is honored before resources are removed when finalizers are used.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, postgresql
Domain
databases, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.