Add '--registry' option on running container
This is the client side implementation for: https://review.openstack.org/#/c/628787/ Change-Id: I6792912ddaf4ab3156ab6945286edf29f3286a05 Related-Bug: #1702830
This commit is contained in:
@@ -31,7 +31,7 @@ if not LOG.handlers:
|
||||
HEADER_NAME = "OpenStack-API-Version"
|
||||
SERVICE_TYPE = "container"
|
||||
MIN_API_VERSION = '1.1'
|
||||
MAX_API_VERSION = '1.30'
|
||||
MAX_API_VERSION = '1.31'
|
||||
DEFAULT_API_VERSION = '1.latest'
|
||||
|
||||
_SUBSTITUTIONS = {}
|
||||
|
@@ -210,6 +210,10 @@ class CreateContainer(command.ShowOne):
|
||||
'--wait',
|
||||
action='store_true',
|
||||
help='Wait for create to complete')
|
||||
parser.add_argument(
|
||||
'--registry',
|
||||
metavar='<registry>',
|
||||
help='The container image registry ID or name.')
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@@ -226,6 +230,7 @@ class CreateContainer(command.ShowOne):
|
||||
opts['image_driver'] = parsed_args.image_driver
|
||||
opts['auto_remove'] = parsed_args.auto_remove
|
||||
opts['command'] = parsed_args.command
|
||||
opts['registry'] = parsed_args.registry
|
||||
if parsed_args.security_group:
|
||||
opts['security_groups'] = parsed_args.security_group
|
||||
if parsed_args.expose_port:
|
||||
@@ -895,6 +900,10 @@ class RunContainer(command.ShowOne):
|
||||
'--wait',
|
||||
action='store_true',
|
||||
help='Wait for run to complete')
|
||||
parser.add_argument(
|
||||
'--registry',
|
||||
metavar='<registry>',
|
||||
help='The container image registry ID or name.')
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@@ -911,6 +920,7 @@ class RunContainer(command.ShowOne):
|
||||
opts['image_driver'] = parsed_args.image_driver
|
||||
opts['auto_remove'] = parsed_args.auto_remove
|
||||
opts['command'] = parsed_args.command
|
||||
opts['registry'] = parsed_args.registry
|
||||
if parsed_args.security_group:
|
||||
opts['security_groups'] = parsed_args.security_group
|
||||
if parsed_args.expose_port:
|
||||
|
@@ -26,7 +26,7 @@ CREATION_ATTRIBUTES = ['name', 'image', 'command', 'cpu', 'memory',
|
||||
'security_groups', 'hints', 'nets', 'auto_remove',
|
||||
'runtime', 'hostname', 'mounts', 'disk',
|
||||
'availability_zone', 'auto_heal', 'privileged',
|
||||
'exposed_ports', 'healthcheck']
|
||||
'exposed_ports', 'healthcheck', 'registry']
|
||||
|
||||
|
||||
class Container(base.Resource):
|
||||
|
@@ -181,6 +181,9 @@ def _show_container(container):
|
||||
'retries: Consecutive failures needed to report unhealthy. '
|
||||
'timeout: Maximum time to allow one check to run (s|m|h)'
|
||||
' (default 0s).')
|
||||
@utils.arg('--registry',
|
||||
metavar='<registry>',
|
||||
help='The container image registry ID or name')
|
||||
def do_create(cs, args):
|
||||
"""Create a container."""
|
||||
opts = {}
|
||||
@@ -202,6 +205,7 @@ def do_create(cs, args):
|
||||
opts['disk'] = args.disk
|
||||
opts['availability_zone'] = args.availability_zone
|
||||
opts['command'] = args.command
|
||||
opts['registry'] = args.registry
|
||||
if args.healthcheck:
|
||||
opts['healthcheck'] = zun_utils.parse_health(args.healthcheck)
|
||||
|
||||
@@ -701,6 +705,9 @@ def do_kill(cs, args):
|
||||
'retries: Consecutive failures needed to report unhealthy. '
|
||||
'timeout: Maximum time to allow one check to run (s|m|h)'
|
||||
' (default 0s).')
|
||||
@utils.arg('--registry',
|
||||
metavar='<registry>',
|
||||
help='The container image registry ID or name')
|
||||
def do_run(cs, args):
|
||||
"""Run a command in a new container."""
|
||||
opts = {}
|
||||
@@ -722,6 +729,7 @@ def do_run(cs, args):
|
||||
opts['disk'] = args.disk
|
||||
opts['availability_zone'] = args.availability_zone
|
||||
opts['command'] = args.command
|
||||
opts['registry'] = args.registry
|
||||
if args.healthcheck:
|
||||
opts['healthcheck'] = zun_utils.parse_health(args.healthcheck)
|
||||
|
||||
|
Reference in New Issue
Block a user