Skip to content

controllerrevision not cleaned up after Postgresql deletion #2913

Open
@fabianem

Description

@fabianem

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? 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] K8s
  • Are you running Postgres Operator in production? [yes | no] yes
  • Type of issue? [Bug report, question, feature request, etc.] Bug report

Hi,

I’m running the Zalando Postgres Operator in cluster-wide mode, and overall the resource cleanup during Postgresql instance deletion works well. However, I’ve observed that controllerrevision resources are left behind after deleting a Postgresql CR - even though other resources like StatefulSets, Pods, Services, and Secrets are properly removed.

My operator configuration includes enable_owner_references: true:

configKubernetes:
    pod_management_policy: "parallel"
    enable_persistent_volume_claim_deletion: true
    enable_finalizers: false
    enable_owner_references: true
    enable_pod_antiaffinity: false
    cluster_domain: "cluster.local"
...

Upon inspecting the controllerrevision resource before deletion, it correctly has an ownerReference pointing to the corresponding StatefulSet. However, after the Postgresql CR is deleted and the StatefulSet is removed, the controllerrevision remains - and its ownerReference is gone.

This suggests that the controllerrevision becomes orphaned during the deletion process. I suspect this might be due to the use of metav1.DeletePropagationOrphan when deleting the StatefulSet.

Would switching to DeletePropagationForeground be more appropriate here to allow Kubernetes to garbage collect the controllerrevision via its ownership chain?

Thanks in advance for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions