getsentry / skrooge

A quick and dirty kubernetes cost estimator
Apache License 2.0
4 stars 0 forks source link

Constrained resource is calculated incorrectly for negative amounts #6

Open mwarkentin opened 10 months ago

mwarkentin commented 10 months ago

Steps to Reproduce

skrooge estimate -i n2-standard-32 -r 30 -c 2500 -m 2024
constrained_resource='cores'

skrooge estimate -i n2-standard-32 -r 30 -c -2500 -m -2024
constrained_resource='memory'

Expected Result

skrooge estimate -i n2-standard-32 -r 30 -c 2500 -m 2024
constrained_resource='cores'

skrooge estimate -i n2-standard-32 -r 30 -c -2500 -m -2024
constrained_resource='cores'

Actual Result

Logic for calculating constrained resource just does a naive calculation of cpu > mem which is backwards if these are negative values.

skrooge estimate -i n2-standard-32 -r 30 -c 2500 -m 2024
constrained_resource='cores'

skrooge estimate -i n2-standard-32 -r 30 -c -2500 -m -2024
constrained_resource='memory'

TODO: