mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-14 15:58:38 -05:00
Implement container-cluster aware capacity determination
* Added two settings values for declaring absolute cpu and memory capacity that will be picked up by the capacity utility methods * installer inventory variables for controlling the amount of cpu and memory container requests/limits for the awx task containers * Added fixed values for cpu and memory container requests for other containers * configmap uses the declared inventory variables to define the capacity inputs that will be used by AWX to correspond to the same inputs for requests/limits on the deployment.
This commit is contained in:
@@ -646,6 +646,15 @@ def get_cpu_capacity():
|
||||
from django.conf import settings
|
||||
settings_forkcpu = getattr(settings, 'SYSTEM_TASK_FORKS_CPU', None)
|
||||
env_forkcpu = os.getenv('SYSTEM_TASK_FORKS_CPU', None)
|
||||
|
||||
settings_abscpu = getattr(settings, 'SYSTEM_TASK_ABS_CPU', None)
|
||||
env_abscpu = os.getenv('SYSTEM_TASK_ABS_CPU', None)
|
||||
|
||||
if env_abscpu is not None:
|
||||
return 0, int(env_abscpu)
|
||||
elif settings_abscpu is not None:
|
||||
return 0, int(settings_abscpu)
|
||||
|
||||
cpu = psutil.cpu_count()
|
||||
|
||||
if env_forkcpu:
|
||||
@@ -661,6 +670,15 @@ def get_mem_capacity():
|
||||
from django.conf import settings
|
||||
settings_forkmem = getattr(settings, 'SYSTEM_TASK_FORKS_MEM', None)
|
||||
env_forkmem = os.getenv('SYSTEM_TASK_FORKS_MEM', None)
|
||||
|
||||
settings_absmem = getattr(settings, 'SYSTEM_TASK_ABS_MEM', None)
|
||||
env_absmem = os.getenv('SYSTEM_TASK_ABS_MEM', None)
|
||||
|
||||
if env_absmem is not None:
|
||||
return 0, int(env_absmem)
|
||||
elif settings_absmem is not None:
|
||||
return 0, int(settings_absmem)
|
||||
|
||||
if env_forkmem:
|
||||
forkmem = int(env_forkmem)
|
||||
elif settings_forkmem:
|
||||
|
||||
Reference in New Issue
Block a user