Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete named PVCs if they contain {user_server} #873

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

manics
Copy link
Member

@manics manics commented Nov 15, 2024

pod_name_template was updated in 7.0.0, but the logic to detect whether a named server PVC is safe to delete wasn't.

@manics manics added the bug label Nov 15, 2024
Copy link
Member

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Simon!!

@@ -3807,7 +3807,7 @@ async def delete_forever(self):
self.log.info(f"Not deleting pvc for {log_name}: {self.pvc_name}")
return

if self.name and '{servername}' not in self.pvc_name_template:
if self.name and '{user_server}' not in self.pvc_name_template:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not confident about what makes sense here, it seems like we want to ensure that we don't delete a named servers PVC if its shared. Due to that, should we maybe instead check for either servername and user_server?

Is servername still accepted, or was it removed entirely?

Copy link
Member Author

@manics manics Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is inverted so we're only deleting if pvc_name_template contains {user_server}.

We could also delete the PVC if the template contains {servername} as in KubeSpawner 6 but strictly speaking this isn't completely safe, since if (for some unknown reason) an admin wanted all users to share the same volume based on servername (and ignoring username) we'd incorrectly delete the PVC.

There's also the problem of future maintenance- the more conditions we add the more likely it is to break in future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking, thank you for being so thorough @manics!!

@consideRatio consideRatio merged commit 5ac45e9 into jupyterhub:main Nov 15, 2024
9 checks passed
@manics manics deleted the delete-named-pvc branch November 15, 2024 18:04
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.

2 participants