Skip to content

Delete services with background propagation so their EndpointSlices are removed - #3189

Open
somaz94 wants to merge 2 commits into
zalando:masterfrom
somaz94:fix/service-delete-propagation
Open

somaz94 wants to merge 2 commits into
zalando:masterfrom
somaz94:fix/service-delete-propagation

Conversation

@somaz94

@somaz94 somaz94 commented Sep 22, 2026

Copy link
Copy Markdown

Problem description

When a cluster is deleted, deleteService passes the cluster wide deleteOptions, which use DeletePropagationOrphan. The replica service has a selector, so its EndpointSlices are created by the EndpointSlice controller with the Service as owner. With orphan propagation the garbage collector only removes that owner reference, and the slices stay in the namespace after the Service is gone. The master service is not affected because its slices are mirrored from the Endpoints object the operator deletes itself, and the pooler services already use their own propagation policy in deleteConnectionPooler.

This change uses background propagation in deleteService only. The shared deleteOptions and the statefulset path stay as they are, since deleteStatefulSet orphans the pods on purpose and removes them itself.

A new unit test checks the propagation policy sent for the master and replica service deletes. It fails on master with Orphan and passes with this change. make mocks, make linux and go test -race ./... pass locally.

Linked issues

Fixes #2973

#2913 reports the same orphan behaviour for ControllerRevisions through the statefulset delete. I left it out of this PR so that change can be checked against the e2e tests on its own.

Checklist

Thanks for submitting a pull request to the Postgres Operator project.
Please, ensure your contribution matches the following items:

  • Your go code is formatted. Your IDE should do it automatically for you.
  • You have updated generated code when introducing new fields to the acid.zalan.do api package.
  • New configuration options are reflected in CRD validation, helm charts and sample manifests.
  • New functionality is covered by unit and/or e2e tests.
  • You have checked existing open PRs for possible overlay and referenced them.

I used Claude Code to help investigate the issue and write the test.

@FxKu FxKu added this to the 2.0.3 milestone Sep 22, 2026
@somaz94
somaz94 marked this pull request as ready for review September 23, 2026 01:54
@somaz94

somaz94 commented Sep 23, 2026

Copy link
Copy Markdown
Author

Thanks for the label and for merging master in. I've marked this ready for review. The unit tests pass, and the e2e failure is test_major_version_upgrade, which failed the same way on master in run 33736493007 on September 3. Since the suite stops at the first failure, the deletion tests after it did not run on this commit, so a re-run would cover those too.

@FxKu FxKu modified the milestones: 2.0.3, 2.1.0 Sep 24, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EndpointSlices not cleaned up after replica service deletion (orphaned resources)

2 participants