neondatabase / autoscaling

Postgres vertical autoscaling in k8s
Apache License 2.0
144 stars 18 forks source link

neonvm: Make .guest.settings.swap *resource.Quantity, add swapV2 #912

Closed sharnoff closed 3 months ago

sharnoff commented 3 months ago

There were a handful of issues with the approach from #887. It changed the type of .guest.settings.swap. This commit changes it back, and makes a new field for the new type.

Under certain circumstances, changing the type of the field could have worked, but even with with fully inter-compatible serializing (see #911) the CRD prevents a type's field from being either a string or an object, which is what's required for full compatibility.

We could have done this if there were no VMs using swap, but we unfortunately have a small number of VirtualMachines in production with swap enabled.

So we're left with the "hard" route - adding a new field with a different type (swapV2), special-casing object updates to allow switching from the old type to the new one (but only if the values are the same), and then eventually once all VirtualMachine objects are using the new field, switch the type of the old one and move back to the old field with the new type.

See https://neondb.slack.com/archives/C06SW383C79/p1713298689471319. Part of neondatabase/cloud#12047.

sharnoff commented 3 months ago

From discussion: Ideally we could simply ignore/delete/replace Swap, but this isn't currently an option because we have a small number of computes in prod that are using it.