-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add support for creating volume and network with label definition #3898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| v for v in self.client.volumes().get('Volumes', []) | ||
| if v['Name'].startswith('composetest_') | ||
| ] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we don't need sorted() here since there's a single element
|
Thanks! This is quite thourough. There's a few things I see:
|
|
@alexmavr I'm sorry I close this pr by accident just now. |
shin-
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dbdd4us - sorry it took so long to get back to you. I wanted to have the changes from #3653 merged before we move forward with this.
I added a few comments to highlight the changes that need to be made to make the labels directives part of the 2.1 file format. They're trivial changes, but let me know if anything is unclear and I'll be happy to help. :)
| }, | ||
| "internal": {"type": "boolean"} | ||
| "internal": {"type": "boolean"}, | ||
| "labels": {"$ref": "#/definitions/list_or_dict"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that config_schema_v2.1.json has been merged, we can move this property there.
| "name": {"type": "string"} | ||
| } | ||
| }, | ||
| "labels": {"$ref": "#/definitions/list_or_dict"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that config_schema_v2.1.json has been merged, we can move this property there.
requirements.txt
Outdated
| backports.ssl-match-hostname==3.5.0.1; python_version < '3' | ||
| cached-property==1.2.0 | ||
| docker-py==1.9.0 | ||
| docker-py==1.10.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll probably get a merge conflict here since we bumped to 1.10.3 in master.
| self.dispatch(['-f', filename, 'up', '-d']) | ||
| container = self.project.containers()[0] | ||
| assert list(container.get('NetworkSettings.Networks')) == [network_name] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to @v2_1_only()
| assert [n['Name'] for n in networks] == [network_with_label] | ||
|
|
||
| assert networks[0]['Labels'] == {'label_key': 'label_val'} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to @v2_1_only()
| network = self.client.networks(names=['composetest_internal'])[0] | ||
|
|
||
| assert network['Internal'] is True | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to @v2_1_only()
| volume_data = self.client.inspect_volume(full_vol_name) | ||
| self.assertEqual(volume_data['Name'], full_vol_name) | ||
| self.assertEqual(volume_data['Driver'], 'local') | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to @v2_1_only()
docs/compose-file.md
Outdated
| name: actual-name-of-volume | ||
|
|
||
| ### labels | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs the > Added in version 2.1 file format line, similar to this
docs/compose-file.md
Outdated
| name: actual-name-of-network | ||
|
|
||
| ### labels | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs the > Added in version 2.1 file format line, similar to this
73da01e to
0fcdeb3
Compare
|
@shin- PR Updated, PTAL I'm confused about the |
|
"Reorder python imports" is a lint/style check performed by pre-commit. It means the imports are not ordered correctly. You can either install http://pre-commit.com/ and run it to fix the issue, or you can re-order them manually. Imports should be sorted and grouped according to "built-in", "third-party", "local" I think in this case it doesn't like the multiple imports on a single line, and is moving it onto a new line |
|
@dnephin |
shin-
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
WIth the docs moving to a separate repository, this needs a rebase that removes the |
|
@shin- |
Signed-off-by: dbdd <wangtong2712@gmail.com>
|
LGTM (IANAM) |
|
Closes #3107 |
aanand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #3892
- What I did
Add volume and network label support for compose file v2
- How I did it
-How to verify it
Add test in tests/unit/config/config_test.py, tests/integration/project_test.py and tests/acceptance/cli_test.py
@shin- PTAL
Signed-off-by: dbdd wangtong2712@gmail.com