diff options
| author | Kuo-tung Kao <jelly.k@inwinstack.com> | 2015-10-14 16:19:45 +0800 |
|---|---|---|
| committer | Kuo-tung Kao <ya790206@gmail.com> | 2015-10-17 10:08:03 +0800 |
| commit | 52b72538114fdf3de5b71ce399bb0992d2748d75 (patch) | |
| tree | fa60fd599594ef47e750de30c46cc51f407e51e7 /kolla | |
| parent | bd010bdee2794990de381adf99f841ab237f58c6 (diff) | |
| download | kolla-52b72538114fdf3de5b71ce399bb0992d2748d75.tar.gz kolla-52b72538114fdf3de5b71ce399bb0992d2748d75.zip | |
add "registry" flag to "tools/build.py"
With registry flag,
build image using `tools/build.py --registry 172.22.2.81:4000`
the image name looks like `172.22.2.81:4000/kollaglue/data`
When user use kolla-ansible,
user set `docker_registry` to `172.22.2.81:4000` in `/etc/kolla/globals.yml`.
Build image using `tools/build.py -n abcd`
the image name looks like `abcd/data`
When user use kolla-ansible,
user set `docker_namespace:` to `abcd` in `/etc/kolla/globals.yml`.
build image using `tools/build.py -n abcd --registry 172.22.2.81:4000`
the image name looks like `abcd/data`
When user use kolla-ansible,
user set `docker_namespace:` to `abcd` in `/etc/kolla/globals.yml`.
user set `docker_registry` to `172.22.2.81:4000` in `/etc/kolla/globals.yml`.
With the feature, it will reduce user confusing and mistaking.
Change-Id: I18ac7a3ccec032888e35f5e9a79fc190760cc8a0
Closes-Bug: #1505056
Diffstat (limited to 'kolla')
| -rwxr-xr-x | kolla/cmd/build.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index e6e43dd70..55969c9bd 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -225,7 +225,8 @@ def merge_args_and_config(settings_from_config_file): "keep": False, "push": False, "threads": 8, - "retries": 3 + "retries": 3, + "registry": None } defaults.update(settings_from_config_file.items('kolla-build')) parser.set_defaults(**defaults) @@ -285,6 +286,9 @@ def merge_args_and_config(settings_from_config_file): parser.add_argument('--template-only', help=("Don't build images. Generate Dockerfile only"), action='store_true') + parser.add_argument('--registry', + help=("the docker registry host"), + type=str) return vars(parser.parse_args()) @@ -294,7 +298,11 @@ class KollaWorker(object): self.base_dir = os.path.abspath(find_base_dir()) LOG.debug("Kolla base directory: " + self.base_dir) self.images_dir = os.path.join(self.base_dir, 'docker') - self.namespace = config['namespace'] + self.registry = config['registry'] + if self.registry: + self.namespace = self.registry + '/' + config['namespace'] + else: + self.namespace = config['namespace'] self.base = config['base'] self.base_tag = config['base_tag'] self.install_type = config['install_type'] |
