From cfd410df52fd36902307c8974c9eb249892c833d Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Fri, 21 Jul 2023 19:37:19 -0500 Subject: [PATCH] [DNM] wait test Change-Id: I1ea87fd7225e85891a34e6a2f82bcfa328f0e7dd --- armada/handlers/wait.py | 20 +++++++++++++++++++- images/armada/Dockerfile.ubuntu_focal | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) 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..c4e1eb7a 100644 --- a/images/armada/Dockerfile.ubuntu_focal +++ b/images/armada/Dockerfile.ubuntu_focal @@ -92,6 +92,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 + RUN \ chown -R armada:users . && \ python3 setup.py install