Skip to content
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

Add support for declaring named volumes in compose files #2421

Merged
merged 16 commits into from
Jan 7, 2016

Conversation

shin-
Copy link

@shin- shin- commented Nov 19, 2015

  • Bump default API version to 1.21 (required for named volume management)
  • Introduce new, versioned compose file format while maintaining support
    for current (legacy) format
  • Test updates to reflect changes made to the internal API

Fixes #2110, replaces #2113

WIP:

  • Tests
  • Documentation

config = merge_services(config_file.config, next_file.config)
config_file = config_file._replace(config=config)

return build_services(config_file)


def process_config_file(config_file, service_name=None):
def process_config_file(config_file, service_name=None, version=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ServiceExtendsResolver.validate_and_construct_extends() will need to call this with a version as well.

Since version is a required parameter can we make it a position arg instead of a kwarg?

@shin-
Copy link
Author

shin- commented Dec 10, 2015

I think I addressed most of the points brought up in the earlier review, except for the documentation part.

next_file_version = get_version(next_file)
if version is None:
version = next_file_version
continue
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this right, you could have a legacy main file and a version-1 override file, and the ultimate version would be 1.

It scares me that the version decided upon is dependent on the override files. I think it'd be better if we enforced that all files must be the same version.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I might be misreading this. The possible versions are actually 1 and 2, so what does it mean when we return None from get_version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When one config file is empty, as tested here. In that case we can't assume the version to be a specific one, but we don't want to fail either.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just assume the version is 1? An "empty" v2 file should look like this, in my opinion:

version: 2

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think that's better, that's an easy change to make.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated af9291e

@shin-
Copy link
Author

shin- commented Jan 4, 2016

@dnephin @aanand Do we need anything else to proceed with merging this?

@@ -18,7 +18,7 @@ get_versions="docker run --rm
if [ "$DOCKER_VERSIONS" == "" ]; then
DOCKER_VERSIONS="$($get_versions default)"
elif [ "$DOCKER_VERSIONS" == "all" ]; then
DOCKER_VERSIONS="$($get_versions recent -n 2)"
DOCKER_VERSIONS="$($get_versions recent -n 1)"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding a TODO here to set this back to 2 after the first RC is released?

@dnephin
Copy link

dnephin commented Jan 5, 2016

LGTM, I think we can address the remaining (documentation, and using existing volumes) after this is merged

dnephin and others added 16 commits January 5, 2016 15:09
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Fixes a regression after the API changed to use Mounts.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Bump default API version to 1.21 (required for named volume management)
* Introduce new, versioned compose file format while maintaining support
  for current (legacy) format
* Test updates to reflect changes made to the internal API

Signed-off-by: Joffrey F <joffrey@docker.com>
Add volume configuration reference section.

Signed-off-by: Joffrey F <joffrey@docker.com>
Also includes several bugfixes for resolution and validation.

Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
When created through the compose file, volumes are prefixed
with the name of the project they belong to + underscore,
similarly to how containers are currently handled.

Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
Assume version=1 if file is empty in get_config_version
Empty files are invalid anyway, so this simplifies the algorithm
somewhat.
docker#2421 (comment)

Don't leak version considerations in interpolation/service validation

Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Joffrey F <joffrey@docker.com>
@shin-
Copy link
Author

shin- commented Jan 5, 2016

Squashed some commits + rebased.

aanand added a commit that referenced this pull request Jan 7, 2016
Add support for declaring named volumes in compose files
@aanand aanand merged commit ed87d1f into docker:master Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants