-
Notifications
You must be signed in to change notification settings - Fork 260
CNS - Container Network Service #64
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
Creates container network service (CNS). CNS is a service that exposes a set of REST API calls to provision networking for containers in Linux and Windows. It currently requires docker daemon to be running on the node, as well as azure-vnet plugins for IPAM and Network.
…iner-networking into preserveroutes
Capability to restore routes that are lost during network create.
Restore routes.
API Versioning v0.1
Integrating IPAM with CNS
ofiliz
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.
Intermediate feedback. This code should either be in its own repository, or be renamed to sf package. It doesn't fit with the rest of the code in the repo.
| // Copyright 2017 Microsoft. All rights reserved. | ||
| // MIT License | ||
|
|
||
| package common |
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.
Let's move this to the same package as the rest of these changes. No need to put it in common. Nobody else uses this object.
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.
This is basically a duplicate of the base plugin class renamed to service. We should really move it to your directory, rest of the code doesn't need it.
cns/api.go
Outdated
|
|
||
| // SetEnvironmentRequest describes the Request to set the environment in CNS. | ||
| type SetEnvironmentRequest struct { | ||
| Location string |
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.
Did you run "go fmt" on these files?
cns/examples/examples.go
Outdated
| @@ -0,0 +1,198 @@ | |||
| // Copyright 2017 Microsoft. All rights reserved. | |||
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.
We should convert these fuctions to tests, which clients can then learn from. Or maybe convert to documentation.
|
|
||
| // GetPrimaryInterfaceInfoFromHost retrieves subnet and gateway of primary NIC from Host. | ||
| func (imdsClient *ImdsClient) GetPrimaryInterfaceInfoFromHost() (*InterfaceInfo, error) { | ||
| log.Printf("[Azure CNS] GetPrimaryInterfaceInfoFromHost") |
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.
"[Azure CNS]": Too long. Why not just call it "[sf]"? This is in reality a proxy that implements a custom service fabric interface.
Integration of ipam in cns
Fix the case of api call path
cns/ipamclient/api.go
Outdated
| @@ -0,0 +1,73 @@ | |||
| package ipamclient | |||
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.
Why do we even have this file? All these definitions are duplicates from ipam.api, right?
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.
Those request and response structures are not exposed to public. That's why I duplicated it.
| package ipamclient | ||
|
|
||
| const ( | ||
| defaultIpamPluginURL = "http://localhost:48080" |
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.
It is not a good idea to hard code this. You should read it from the plugin spec file. This will also allow you to remove ipamclient_windows vs _linux versions. If the spec file does not exist, it is Linux.
| mux.ServeHTTP(w, req) | ||
| return w | ||
| } | ||
| func TestSetEnvironment(t *testing.T) { |
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.
Please add blank line. Multiple instances below.
Move cns common service code inside cns folder
Add line spacing in restserver test code.
Reusing CNM IPAM package in ipamclient
Remove CNS usage examples.
This PR contains implementation for container network service (CNS).
CNS is a service that exposes a set of REST API calls to support/manage networking for containers in Windows and Linux. It currently requires docker daemon to be running on the node, as well as azure-vnet plugins for IPAM and Network.
CNS is not yet integrated in build path. As such, it does not get built by default.
Supported Scenarios: Windows/Azure
Future Scenarios: Linux/Azure, Windows/Overlay, Linux/Overlay