jitsi / jitsi-autoscaler

Jitsi Autoscaler microservice
Apache License 2.0
30 stars 18 forks source link

Correctly validate new max, by computing it in validate the same way … #116

Closed raluca8x8 closed 3 years ago

raluca8x8 commented 3 years ago

…as in launch protected

The initial problem was that if (max > instanceGroup.scalingOptions.maxDesired) was failing because max was only assigned to 0. That condition should have been if (req.body.maxDesired > instanceGroup.scalingOptions.maxDesired).

Moreover, I updated the validation logic to make sure the new max we are validating against has the same value as the max used in launchProtectedInstanceGroup. Therefore the current validation will not care if the new maxDesired is lower or higher than the old max, will only care if the new maxDesired is correct, meaning new launched instances + current desired <= new maxDesired.