Merge "Add 'init_containers' field to capsule"

This commit is contained in:
Zuul 2019-05-27 03:31:51 +00:00 committed by Gerrit Code Review
commit 83eaf006d6
7 changed files with 22 additions and 5 deletions

View File

@ -26,7 +26,7 @@
test-config:
$TEMPEST_CONFIG:
container_service:
min_microversion: 1.33
min_microversion: 1.34
devstack_services:
tempest: true
devstack_plugins:

View File

@ -33,6 +33,7 @@ _basic_keys = (
'labels',
'memory',
'cpu',
'init_containers',
'containers',
'host',
)
@ -59,6 +60,13 @@ def format_capsule(url, capsule, context, legacy_api_version=False):
yield('containers_uuids', [])
yield('init_containers_uuids', [])
yield('capsule_version', '')
elif key == 'init_containers':
containers = []
for c in capsule.init_containers:
container = containers_view.format_container(
context, None, c)
containers.append(container)
yield ('init_containers', containers)
elif key == 'containers':
containers = []
for c in capsule.containers:

View File

@ -66,10 +66,11 @@ REST_API_VERSION_HISTORY = """REST API Version History:
* 1.31 - Add 'registry_id' to containers
* 1.32 - Make capsule deletion asynchronized
* 1.33 - Add 'finish_time' to container actions
* 1.34 - Add 'init_containers' to capsule
"""
BASE_VER = '1.1'
CURRENT_MAX_VER = '1.33'
CURRENT_MAX_VER = '1.34'
class Version(object):

View File

@ -255,3 +255,9 @@ user documentation.
Add 'finish_time' to container action resource.
If the action is finished, 'finish_time' shows the finish time.
Otherwise, this field will be None.
1.34
----
Add 'init_containers' to capsule.
This field contains a list of init_container information.

View File

@ -421,6 +421,8 @@ class Capsule(ContainerBase):
def as_dict(self):
capsule_dict = super(Capsule, self).as_dict()
capsule_dict['containers'] = [c.as_dict() for c in self.containers]
capsule_dict['init_containers'] = [c.as_dict()
for c in self.init_containers]
return capsule_dict
def obj_load_attr(self, attrname):

View File

@ -26,7 +26,7 @@ from zun.tests.unit.db import base
PATH_PREFIX = '/v1'
CURRENT_VERSION = "container 1.33"
CURRENT_VERSION = "container 1.34"
class FunctionalTest(base.DbTestCase):

View File

@ -28,7 +28,7 @@ class TestRootController(api_base.FunctionalTest):
'default_version':
{'id': 'v1',
'links': [{'href': 'http://localhost/v1/', 'rel': 'self'}],
'max_version': '1.33',
'max_version': '1.34',
'min_version': '1.1',
'status': 'CURRENT'},
'description': 'Zun is an OpenStack project which '
@ -37,7 +37,7 @@ class TestRootController(api_base.FunctionalTest):
'versions': [{'id': 'v1',
'links': [{'href': 'http://localhost/v1/',
'rel': 'self'}],
'max_version': '1.33',
'max_version': '1.34',
'min_version': '1.1',
'status': 'CURRENT'}]}