mirror of
https://github.com/ansible/awx.git
synced 2026-04-04 17:55:06 -02:30
Merge pull request #3850 from ansible/container-groups-cleanup-adhoc
clean up pods for all k8s execution, not just playbook runs
This commit is contained in:
@@ -1094,6 +1094,13 @@ class BaseTask(object):
|
|||||||
if os.path.isdir(job_profiling_dir):
|
if os.path.isdir(job_profiling_dir):
|
||||||
shutil.copytree(job_profiling_dir, os.path.join(awx_profiling_dir, str(instance.pk)))
|
shutil.copytree(job_profiling_dir, os.path.join(awx_profiling_dir, str(instance.pk)))
|
||||||
|
|
||||||
|
if instance.is_containerized:
|
||||||
|
from awx.main.scheduler.kubernetes import PodManager # prevent circular import
|
||||||
|
pm = PodManager(instance)
|
||||||
|
logger.debug(f"Deleting pod {pm.pod_name}")
|
||||||
|
pm.delete()
|
||||||
|
|
||||||
|
|
||||||
def event_handler(self, event_data):
|
def event_handler(self, event_data):
|
||||||
#
|
#
|
||||||
# ⚠️ D-D-D-DANGER ZONE ⚠️
|
# ⚠️ D-D-D-DANGER ZONE ⚠️
|
||||||
@@ -1841,13 +1848,6 @@ class RunJob(BaseTask):
|
|||||||
if isolated_manager_instance and not job.is_containerized:
|
if isolated_manager_instance and not job.is_containerized:
|
||||||
isolated_manager_instance.cleanup()
|
isolated_manager_instance.cleanup()
|
||||||
|
|
||||||
if job.is_containerized:
|
|
||||||
from awx.main.scheduler.kubernetes import PodManager # prevent circular import
|
|
||||||
pm = PodManager(job)
|
|
||||||
logger.debug(f"Deleting pod {pm.pod_name}")
|
|
||||||
pm.delete()
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
inventory = job.inventory
|
inventory = job.inventory
|
||||||
except Inventory.DoesNotExist:
|
except Inventory.DoesNotExist:
|
||||||
|
|||||||
Reference in New Issue
Block a user