[DNM] wait test
Change-Id: I1ea87fd7225e85891a34e6a2f82bcfa328f0e7dd
This commit is contained in:
parent
812546c875
commit
d038cd66a7
2
Makefile
2
Makefile
|
@ -108,7 +108,7 @@ ifeq ($(USE_PROXY), true)
|
|||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||
else
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) \
|
||||
docker build --no-cache --network host -t $(IMAGE) --label $(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||
|
|
|
@ -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:
|
||||
|
@ -373,7 +374,7 @@ class ResourceWait(ABC):
|
|||
function to handle.
|
||||
'''
|
||||
LOG.debug(
|
||||
'Starting to wait on: namespace=%s, resource type=%s, '
|
||||
'Starting to wait on (armada-go): namespace=%s, resource type=%s, '
|
||||
'label_selector=(%s), timeout=%s',
|
||||
self.chart_wait.release_id.namespace, self.resource_type,
|
||||
self.label_selector, timeout)
|
||||
|
@ -405,6 +406,30 @@ class ResourceWait(ABC):
|
|||
# Only watch new events.
|
||||
kwargs['resource_version'] = resource_list.metadata.resource_version
|
||||
|
||||
command = ['armada-go', 'wait', '--resource-type', "{}s".format(self.resource_type),
|
||||
'--namespace', self.chart_wait.release_id.namespace,
|
||||
'--label-selector', self.label_selector,
|
||||
'--timeout', "{}s".format(timeout)]
|
||||
if hasattr(self, "min_ready"):
|
||||
_, _, m_ready = self.min_ready
|
||||
command.extend(['--min-ready', "{}".format(m_ready)])
|
||||
|
||||
LOG.info('Running command=%s', command)
|
||||
try:
|
||||
with subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, bufsize=1,
|
||||
universal_newlines=True) as sp:
|
||||
for line in sp.stdout:
|
||||
LOG.info(line.rstrip())
|
||||
sp.wait()
|
||||
if sp.returncode != 0:
|
||||
raise subprocess.CalledProcessError(
|
||||
sp.returncode, command, output=sp.stdout)
|
||||
return False, [], [], False
|
||||
except subprocess.CalledProcessError as e:
|
||||
LOG.info("EXCEPTION TRACEBACK %s %s %s", e.output, e.stdout, e.stderr)
|
||||
raise armada_exceptions.WaitException(e)
|
||||
|
||||
w = watch.Watch()
|
||||
for event in w.stream(self.get_resources, **kwargs):
|
||||
event_type = event['type'].upper()
|
||||
|
|
|
@ -20,6 +20,7 @@ RUN set -ex && \
|
|||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
wget \
|
||||
netbase \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
|
@ -92,6 +93,9 @@ 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 chmod a+x /usr/local/bin/armada-go
|
||||
|
||||
RUN \
|
||||
chown -R armada:users . && \
|
||||
python3 setup.py install
|
||||
|
|
Loading…
Reference in New Issue