autoscaling icon indicating copy to clipboard operation
autoscaling copied to clipboard

Feature: Auto-deletion of VirtualMachineMigrations

Open sharnoff opened this issue 11 months ago • 0 comments

Problem description / Motivation

If we start using migrations to help with draining k8s nodes (e.g. for things like the metal node replacements part of neondatabase/cloud#6471), it will be annoying to delete them manually.

Similarly, the scheduler currently has its own implementation of cleaning up migrations that have finished: https://github.com/neondatabase/autoscaling/blob/3a6485943701a4cad20a3f3b619d4a1959fff51e/pkg/plugin/state.go#L1082

So, it may be useful for migrations to have a spec field that allows getting the controller to delete them for us.

Feature idea(s) / DoD / Implementation ideas

A new field on VirtualMachineMigrationSpec — either a boolean (default to false) or a string (e.g. "DeleteOnSuccess" / "DeleteOnCompletion" / etc., default to "don't delete"). And then, the controller can have handling for VMMs in their final states.

The scheduler should also be switched to create migration objects with that field set to clean them up.

And also, when deleting successful/failed/etc migrations, the controller should log relevant information about them.

We could equally have "OnSuccess" and "OnFailure" fields instead to determine the behavior — there's multiple options here.


I'm not sure what prior art here is (e.g. what happens to jobs in k8s when they're done?). Maybe this is a weird feature, I don't know.

sharnoff avatar Aug 25 '23 01:08 sharnoff