Skip to content

Introduce Sandbox entity#365

Merged
mrjana merged 1 commit intomoby:masterfrom
aboch:netc
Aug 28, 2015
Merged

Introduce Sandbox entity#365
mrjana merged 1 commit intomoby:masterfrom
aboch:netc

Conversation

@aboch
Copy link
Contributor

@aboch aboch commented Jul 6, 2015

  • Maps 1 to 1 with container's networking stack
  • It holds container's specific nw options which
    before were incorrectly owned by Endpoint.
  • Sandbox creation no longer coupled with Endpoint Join,
    sandbox and endpoint have now separate lifecycle.
  • LeaveAll naturally replaced by Sandbox.Delete
  • Some name changing in order to have a clear
    mapping between externally exposed resources
    and internal structures
  • Revisited hosts and resolv.conf handling
  • Removed from JoinInfo interface capability of setting hosts and resolv.conf paths
  • Changed etchosts.Build() to first write the search domains and then the nameservers

This PR addresses point 1, 2 and first part of point 3 in issue #429

Signed-off-by: Alessandro Boch aboch@docker.com

@aboch aboch changed the title Introduce NetContainer Introduce Sandbox entity Jul 31, 2015
@dave-tucker dave-tucker added this to the 0.5 milestone Aug 4, 2015
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we are introducing sandbox as the top-level resource, Do we need to expose this backend resource any more ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need a URL for the Join/Leave in the POST/DELETE list.
If we do so, then I feel we should provide the GET for the same URL.

@aboch
Copy link
Contributor Author

aboch commented Aug 19, 2015

@mavenugo, @mrjana Taken care of most of @mavenugo comments.
PTAL when you get a chance.

Copy link
Contributor

Choose a reason for hiding this comment

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

The REST resources needs a cleanup. Not necessarily in this PR, but in a later PR once the UX is in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, once the UX story is finalized, we can remove the URL endpoints which no longer apply.

@mavenugo
Copy link
Contributor

@aboch Thanks for handling all the comments.

LGTM.

api/api.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please convert this into a switch/case statement? Go lang switch/case is feature rich and it's always preferred for readability purposes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually you can create a global map of function type and just retrieve the appropriate function from that. That is more optimal than instantiating the functions every call

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will define the functions somewhere else and only once.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not following the logic of having this byID argument while there is only one way to retrieve the sandboxes. Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just to maintain the same construct I have for network and endpoint.
So that all the GET serving function look alike and follow the same steps when looking for the resource.

endpoint.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant was this should completely become an option passed while creating a sandbox, isn't it? Because this should happen once during sandbox create and there should be no way to add them for every endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. Let me fix that. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually here too, buildHostsFiles need to know to which network we are connecting the sandbox so that it retrieves the SrvcRecords from it and need to know the endpoint to get the IP of the interface.

Seems like this operation cannot be completely moved to sandbox creation.

@aboch
Copy link
Contributor Author

aboch commented Aug 26, 2015

@mrjana I pushed a new change based on your comments.
PTAL when you get a chance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here it looks we were not failing the endpoint join if we fails to update the endpoint into the datastore (err not visible outside of if scope).
New changes took care of this.

- Maps 1 to 1 with container's networking stack
- It holds container's specific nw options which
  before were incorrectly owned by Endpoint.
- Sandbox creation no longer coupled with Endpoint Join,
  sandbox and endpoint have now separate lifecycle.
- LeaveAll naturally replaced by Sandbox.Delete
- some pkg and file renaming in order to have clear
  mapping between structure name and entity ("sandbox")
- Revisited hosts and resolv.conf handling
- Removed from JoinInfo interface capability of setting hosts and resolv.conf paths
- Changed etchosts.Build() to first write the search domains and then the nameservers

Signed-off-by: Alessandro Boch <aboch@docker.com>
@mrjana
Copy link
Contributor

mrjana commented Aug 28, 2015

@aboch Thanks for being patient and taking care of all the comments and doing a bit more cleanup on your own. LGTM

mrjana added a commit that referenced this pull request Aug 28, 2015
Introduce Sandbox entity
@mrjana mrjana merged commit b1992c8 into moby:master Aug 28, 2015
@mrjana mrjana mentioned this pull request Sep 3, 2015
@aboch aboch deleted the netc branch September 6, 2015 17:30
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.

4 participants