uselagoon / remote-controller

A group of controllers for handling Lagoon builds and tasks in Kubernetes or Openshift
5 stars 1 forks source link

Clean up expiring namespaces #161

Open shreddedbacon opened 2 years ago

shreddedbacon commented 2 years ago

During migrations of environments from one target to another, the old namespace remains in the old target after migrations are performed, and could be forgotten about.

It could be useful to scan namespaces for a label like lagoon.sh/expiration=${timestamp} and then perform a deletion of that namespace.

shreddedbacon commented 2 years ago

Some ideas for labels:

We could also have configurable warning message too for a period in advance of the expiration date to say that the namespace will be removed.

In some cases development environments could be removed after a defined period too, and the expiration could be incremented after each deployment to ensure it remains active for a period of time.

shreddedbacon commented 2 years ago

@bomoko looping you in here for ideas

bomoko commented 2 years ago

@shreddedbacon - I'm very happy with any and all of these suggestions.

Perhaps as a start we can start with the simple lagoon.sh/expiration=${timestamp} case.

shreddedbacon commented 7 months ago

Since Lagoon namespace tokens can't label the namespace, but a task in Lagoon that performs migrations may need a way to mark an old namespace as ready for removal, there needs to be a way to mark a namespace as expired via something like a kind: Secret or kind: Configmap that contains the expiration timestamp.