diff --git a/armada/handlers/wait.py b/armada/handlers/wait.py index 5fcfa14f..66e56435 100644 --- a/armada/handlers/wait.py +++ b/armada/handlers/wait.py @@ -17,6 +17,7 @@ import collections import copy import math import re +import subprocess import time from kubernetes import watch @@ -343,7 +344,7 @@ class ResourceWait(ABC): timed_out, modified, unready, found_resources = ( self._watch_resource_completions(timeout=deadline_remaining)) - if (not found_resources) and not self.required: + if not found_resources: return None if timed_out: @@ -405,6 +406,23 @@ class ResourceWait(ABC): # Only watch new events. kwargs['resource_version'] = resource_list.metadata.resource_version + command = ['armada-go', 'wait', '--resource-type', self.resource_type, + '--namespace', self.chart_wait.release_id.namespace, + '--label-selector', self.label_selector, + '--timeout', "{}s".format(timeout)] + + LOG.info('Running command=%s', command) + try: + subprocess.run( # nosec + command, check=True, universal_newlines=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + timeout=timeout) + + return False, [], [], False + except subprocess.CalledProcessError as e: + raise armada_exceptions.WaitException(e) + + w = watch.Watch() for event in w.stream(self.get_resources, **kwargs): event_type = event['type'].upper() diff --git a/images/armada/Dockerfile.ubuntu_focal b/images/armada/Dockerfile.ubuntu_focal index b340f403..69563760 100644 --- a/images/armada/Dockerfile.ubuntu_focal +++ b/images/armada/Dockerfile.ubuntu_focal @@ -20,6 +20,7 @@ RUN set -ex && \ ca-certificates \ curl \ git \ + wget \ netbase \ python3-dev \ python3-setuptools \ @@ -92,6 +93,8 @@ COPY . ./ # Setting the version explicitly for PBR ENV PBR_VERSION 0.8.0 +RUN wget -O /usr/local/bin/armada-go https://artifacts-nc.mtn57z.cti.att.com/artifactory/cloud-images-local/armada-go/armada-go && chmod a+x /usr/local/bin/armada-go + RUN \ chown -R armada:users . && \ python3 setup.py install