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

IPAM driver #525

Merged
merged 3 commits into from
Oct 4, 2015
Merged

IPAM driver #525

merged 3 commits into from
Oct 4, 2015

Conversation

aboch
Copy link
Contributor

@aboch aboch commented Sep 15, 2015

This is work in progress for #489

  • ipmapi contract
  • ipam remote driver and registration
  • changes to default ipam to comply with new contract.
  • changes for libnetwork to interact with ipam driver
  • changes to overlay net driver to comply with new model

@aboch aboch mentioned this pull request Sep 15, 2015
config ipamapi.Config
allocator ipamapi.Allocator
// default address spaces are provided by ipam driver at registration time
defaultLocalAddressSpace, defaultGlobalAddressSpace string
Copy link

Choose a reason for hiding this comment

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

minor:
May be we should just have single defaultAddressSpace field, and based on driver's scope we can initialize it at time of registration? This is assuming that IPAM driver operates in one mode at a time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me give you some context (sorry if redundant).

  • The default address space is needed in case UI does not passes it (which will be always the case for first releases). We want the ipam driver to let us know which is the default addr space string.
  • We need two default address spaces, one for local scoped networks (like for ex. bridge) and one to be used for global scoped networks (like for ex. overlay). Because on a docker host both kind of networks can co-exists.

Copy link

Choose a reason for hiding this comment

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

The default address space is needed in case UI does not passes it (which will be always the case for first releases). We want the ipam driver to let us know which is the default addr space string.

got it, that was my understanding too.

We need two default address spaces, one for local scoped networks (like for ex. bridge) and one to be used for global scoped networks (like for ex. overlay). Because on a docker host both kind of networks can co-exists.

I agree that libnetwork need to support both kind of networks, but does libnetwork expects the same IPAM driver to always work for local as well as global scoped networks? I ask as I don't think my driver would be able to serve both local and global scoped networks and it seems better to error out early that routing the request to driver. Would it be better to negotiate this as driver capability instead (like for NetworkDriver) and error out early if user tries to do 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.

@mapuri
Sorry for the late response:
It is not a requirement that a remote ipam driver must serve both local and global scope. As long as it is used in conjunction with the appropriate network driver.

It is instead a requirement for the Default IPAM to serve both local and global scoped net drivers simply because being the default builtin ipam driver, it has to serve both the inbuilt bridge and overlay drivers.

@tomdee
Copy link
Contributor

tomdee commented Sep 16, 2015

Don't forget to update the remote.md file with the changes to the remote driver API.
A similar file for the IPAM driver would be really helpful too 😄

@aboch
Copy link
Contributor Author

aboch commented Sep 19, 2015

@tomdee Thanks missed that. Will update it soon.

@@ -282,6 +328,17 @@ func (c *controller) addNetwork(n *network) error {
}
}

c.Lock()
// Load the ipam driver if not done already
_, ok = c.ipams[n.ipamType]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we wrap the whole looking up an ipam driver in controller in a n.ipam() which will try to lookup ipam from c.ipams[]. If not found it will load the driver. This is a similar change I have made for network drivers. This makes the the whole driver resolution happen wherever we need to get hold of ipam driver and not just during the network creation time because we need to get hold of ipam in other nodes where the network wasn't created but just being used to connect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea. Will change it.

}
}

if err := initIpams(c, c.globalStore); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. initIpamDrivers ?

 - Add IPAM cotract and remote IPAM hooks
 - Add ipam registration in controller
 - Have default IPAM follow ipamapi contract

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

mavenugo commented Oct 3, 2015

@aboch can you please merge https://github.com/aboch/libnetwork_new/pull/6 in your branch and push the PR again (just cherry-pick b2cd7d5 for the docs).

Signed-off-by: Madhu Venugopal <madhu@docker.com>
@mavenugo
Copy link
Contributor

mavenugo commented Oct 4, 2015

thanks @aboch for handling the API changes as suggested and updating the docs.
I agree that this PR is too big to add more on top of it. We can address the open items in subsequent PRs.

@mrjana
Copy link
Contributor

mrjana commented Oct 4, 2015

LGTM

@mavenugo
Copy link
Contributor

mavenugo commented Oct 4, 2015

Thanks @aboch @mrjana for the patient review process.
we still have a few PRs to be merged.

But this PR LGTM.

mavenugo added a commit that referenced this pull request Oct 4, 2015
@mavenugo mavenugo merged commit 0bf5afe into moby:master Oct 4, 2015
@ibuildthecloud
Copy link

👍

@thaJeztah
Copy link
Member

Niceeee 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants