Update pod reaper to work with receptor launched pods

This commit is contained in:
Shane McDonald
2021-04-05 17:45:15 -04:00
parent 6294ddfded
commit 2d48b24ef2
6 changed files with 52 additions and 76 deletions

View File

@@ -3,7 +3,24 @@ from django.conf import settings
from awx.main.models.execution_environments import ExecutionEnvironment
def get_execution_environment_default():
def get_default_execution_environment():
if settings.DEFAULT_EXECUTION_ENVIRONMENT is not None:
return settings.DEFAULT_EXECUTION_ENVIRONMENT
return ExecutionEnvironment.objects.filter(organization=None, managed_by_tower=True).first()
def get_default_pod_spec():
return {
"apiVersion": "v1",
"kind": "Pod",
"metadata": {"namespace": settings.AWX_CONTAINER_GROUP_DEFAULT_NAMESPACE},
"spec": {
"containers": [
{
"image": get_default_execution_environment().image,
"name": 'worker',
}
],
},
}