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

K8s: Tutor should not assume sole control on k8s namespace #1018

Open
waza-ari opened this issue Mar 17, 2024 · 4 comments
Open

K8s: Tutor should not assume sole control on k8s namespace #1018

waza-ari opened this issue Mar 17, 2024 · 4 comments

Comments

@waza-ari
Copy link
Contributor

Bug description

When creating a new environment, tutor will create the namespace automatically. More crucially, when deleting an environment, it will attempt to delete the namespace as well.

This is an issue if the namespace is externally created (in our case, basically the entire cluster except tutor is GitOps managed using ArgoCD), which is also creating the namespace including a few basic services (HashiCorp vault connection for secret store and so on). When tutor attempts to delete the NS, it conflicts with ArgoCD.

Again it might make sense to introduce an additional parameter to control the behaviour.

@DawoudSheraz DawoudSheraz moved this from Pending Triage to Backlog in Tutor project management Mar 19, 2024
@regisb
Copy link
Contributor

regisb commented Mar 26, 2024

What command specifically is causing an issue? What are the logs?

@snglth
Copy link
Contributor

snglth commented Jun 19, 2024

This is a good point. I manage a "sandbox" instance at work. This "sandbox" part means that users and courses are being wiped once in a while. The namespace itself and the cleanup CronJobs are deployed by FluxCD. So, if I run tutor k8s delete tutor delete the cleanup CronJobs and the namespace which is suboptimal in my opinion. There has to be a way to configure tutor to omit deleting objects that was not deployed by tutor. Maybe a flag in config.yml like K8S_EXTERNAL_NAMESPACE set to true to tell tutor to not manage the namespace. @regisb What do you think?

@waza-ari
Copy link
Contributor Author

Ah, sorry for not coming back earlier, I somehow missed the answer. Yes, it's the fact that the namespace being deleted while externally managed (ArgoCD in our case). ArgoCD allows us to provision k8s environments for projects (including the namespace, roles and so on), such that the user works within their assigned NS and permissions.

A flag as suggested by @snglth would be perfect for our use case as well.

@regisb
Copy link
Contributor

regisb commented Jun 19, 2024

Let's not add a new configuration setting without further consideration. There are alternatives:

  • On tutor k8s delete, all tutor does is running kubectl delete -k ~/.local/share/tutor/env --ignore-not-found=true --wait, as per the console output. I think it's pretty easy to run this command manually to add custom filters there, right?
  • Alternatively we could add a --exclude-namespace option to tutor k8s delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants