Skip to content

fix(plugin): delete jobs with destroy command - #5298

Merged
gbartolini merged 2 commits into
cloudnative-pg:mainfrom
leonardoce:destroy-jobs
Aug 21, 2024
Merged

gbartolini merged 2 commits into
cloudnative-pg:mainfrom
leonardoce:destroy-jobs

Conversation

@leonardoce

@leonardoce leonardoce commented Aug 15, 2024 •

Copy link
Copy Markdown
Contributor

When destroying a Postgres instance using the destroy command of the cnpg plugin, we ensure that not only the pods and PVCs are deleted, but also any related jobs.

Closes: #5285

@leonardoce
leonardoce requested a review from a team August 15, 2024 13:16
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Aug 15, 2024
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@armru

armru commented Aug 20, 2024

Copy link
Copy Markdown
Member

I think this should be labeled as fix @leonardoce

@gbartolini gbartolini changed the title feat: delete jobs during kubectl cnpg destroy fix: delete jobs during kubectl cnpg destroy Aug 20, 2024
@leonardoce

Copy link
Copy Markdown
Contributor Author

Yeah. Let'a say it's a fix and back port it too

leonardoce and others added 2 commits August 21, 2024 11:11
When destroying a CNPG PostgreSQL instance that is being created, we
also delete the Job that is initializing the data directory.

Closes: cloudnative-pg#5285

Signed-off-by: Leonardo Cecchi <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
@gbartolini
gbartolini self-requested a review August 21, 2024 09:12
@gbartolini gbartolini changed the title fix: delete jobs during kubectl cnpg destroy fix(plugin): delete jobs with destroy command Aug 21, 2024
@gbartolini gbartolini added the ok to merge 👌 This PR can be merged label Aug 21, 2024
@gbartolini
gbartolini merged commit 9943f69 into cloudnative-pg:main Aug 21, 2024
cnpg-bot pushed a commit that referenced this pull request Aug 21, 2024
When destroying a Postgres instance using the `destroy` command of the
`cnpg` plugin, we ensure that not only the pods and PVCs are deleted,
but also any related jobs.

Closes: #5285

Signed-off-by: Leonardo Cecchi <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit 9943f69)
cnpg-bot pushed a commit that referenced this pull request Aug 21, 2024
When destroying a Postgres instance using the `destroy` command of the
`cnpg` plugin, we ensure that not only the pods and PVCs are deleted,
but also any related jobs.

Closes: #5285

Signed-off-by: Leonardo Cecchi <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit 9943f69)
litaocdl pushed a commit to daanvinken/cloudnative-pg that referenced this pull request Aug 12, 2026
…pg destroy

The previous commit's restructure skipped job cleanup when --keep-pvc is
used, even though that cleanup was introduced by cloudnative-pg#5298 to remove jobs
left over from the instance. The keep-pvc path also still deleted the
pod before detaching the PVCs, leaving the same reattach window the
previous commit closes for the delete path.

Unify both paths so PVCs are handled first, then the pod, then the
jobs, regardless of --keep-pvc, and cover the command with unit tests.

Signed-off-by: Armando Ruocco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases ok to merge 👌 This PR can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cluster stuck following FailedScheduling after scale up

4 participants