netgroup-polito/CrownLabs

[Feature]: Automatic deletion of stale labinstances

giorio94 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Currently, there is no automatic process to delete old labinstances. If students spawn new VMs for their laboratories and forget to delete them, these are never terminated, and the allocated resources are not released (unless performed manually by an administrator).

Describe the solution you'd like
It would be nice to have a periodic task which takes care of this periodic clean-up.
In particular, it should:

  • Be executed periodically, by means of a CronJob (e.g. every 15 minutes).
  • Scan all labtemplates, and retrieve for each one the correct deletion threshold.
  • Scan all labinstances, and delete the ones older than the corresponding threshold obtained from the labtemplate.
  • Be assigned with the correct range of permissions to complete the operation (i.e. not cluster-admin)

Additional context

  1. Different labtemplates may be characterized by different thresholds (or even no threshold), to account for more ephemeral and more persistent environments. Hence, the proposal for configuration at the labtemplate level.
  2. This feature requires to enrich the labtemplate definition with the new field.

Closing, as addressed by #344