Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use multiplier suffix (Gi, Ti, ...) on SCALE_UP_MAX_SIZE #20

Open
lucasfcnunes opened this issue Nov 23, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@lucasfcnunes
Copy link

lucasfcnunes commented Nov 23, 2023

Is your feature request related to a problem? Please describe.

Tried do use scale_up_max_size: 300Gi in the values.yaml of the chart but it didn't work

2023-11-23T11:48:38.529068781Z Traceback (most recent call last):
2023-11-23T11:48:38.529130552Z   File "/app/./main.py", line 4, in <module>
2023-11-23T11:48:38.529156651Z     from helpers import INTERVAL_TIME, PROMETHEUS_URL, DRY_RUN, VERBOSE, get_settings_for_prometheus_metrics, is_integer_or_float, print_human_readable_volume_dict
2023-11-23T11:48:38.529169656Z   File "/app/helpers.py", line 34, in <module>
2023-11-23T11:48:38.529186090Z     SCALE_UP_MAX_SIZE = int(getenv('SCALE_UP_MAX_SIZE') or 16000000000000)           # How many bytes is the maximum disk size that we can resize up, default is 16TB for EBS volumes in AWS (in bytes, so 16000000000000)
2023-11-23T11:48:38.529293525Z                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-23T11:48:38.529335419Z ValueError: invalid literal for int() with base 10: '300Gi'

Describe the solution you'd like

Be able to use suffixes as defined in helpers.py

def convert_storage_to_bytes(storage):
# BinarySI == Ki | Mi | Gi | Ti | Pi | Ei
if storage.endswith('Ki'):
return int(storage.replace("Ki","")) * 1024
if storage.endswith('Mi'):
return int(storage.replace("Mi","")) * 1024 * 1024
if storage.endswith('Gi'):
return int(storage.replace("Gi","")) * 1024 * 1024 * 1024
if storage.endswith('Ti'):
return int(storage.replace("Ti","")) * 1024 * 1024 * 1024 * 1024
if storage.endswith('Pi'):
return int(storage.replace("Pi","")) * 1024 * 1024 * 1024 * 1024 * 1024
if storage.endswith('Ei'):
return int(storage.replace("Ei","")) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024
# decimalSI == m | k | M | G | T | P | E | "" (this last one is the fallthrough at the end)
if storage.endswith('k'):
return int(storage.replace("k","")) * 1000
if storage.endswith('K'):
return int(storage.replace("K","")) * 1000
if storage.endswith('m'):
return int(storage.replace("m","")) * 1000 * 1000
if storage.endswith('M'):
return int(storage.replace("M","")) * 1000 * 1000
if storage.endswith('G'):
return int(storage.replace("G","")) * 1000 * 1000 * 1000
if storage.endswith('T'):
return int(storage.replace("T","")) * 1000 * 1000 * 1000 * 1000
if storage.endswith('P'):
return int(storage.replace("P","")) * 1000 * 1000 * 1000 * 1000 * 1000
if storage.endswith('E'):
return int(storage.replace("E","")) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000
# decimalExponent == e | E (in the middle of two integers)
lowercaseDecimalExponent = storage.split('e')
uppercaseDecimalExponent = storage.split('E')
if len(lowercaseDecimalExponent) > 1 or len(uppercaseDecimalExponent) > 1:
return int(float(str(format(float(storage)))))
# If none above match, then it should just be an integer value (in bytes)
return int(storage)

@lucasfcnunes lucasfcnunes added the enhancement New feature or request label Nov 23, 2023
@AndrewFarley
Copy link
Contributor

This is an awesome feature request! Will definitely try to make this happen!

@lucasfcnunes lucasfcnunes changed the title Can't use multiplier suffix (Gi, Ti) on SCALE_UP_MAX_SIZE Can't use multiplier suffix (Gi, Ti, ...) on SCALE_UP_MAX_SIZE Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants