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

Windows CNI support #193

Merged
merged 2 commits into from
Sep 20, 2018
Merged

Windows CNI support #193

merged 2 commits into from
Sep 20, 2018

Conversation

thxCode
Copy link
Contributor

@thxCode thxCode commented Aug 23, 2018

A patch PR for #85

@thxCode
Copy link
Contributor Author

thxCode commented Aug 23, 2018

@rosenhouse

  • rebase to master
  • update deps

build script: GOARCH=amd64 ./build.sh

@benmoss
Copy link
Contributor

benmoss commented Aug 28, 2018

LGTM 👍

@rosenhouse
Copy link
Contributor

rosenhouse commented Aug 29, 2018

ok, so this isn't so much a patch on top of #85, just a replacement for it. we'd just merge this one and close that one.

When we merge, we can fix-up the middle commit to include the original authors (@rakelkar and @madhanrm) as Co-authored-by: lines. Sound good to everyone?

cc @dineshgovindasamy


Edit: Here's a branch with the same contents as this PR, but with commit messages slightly fixed up, giving credit to original authors: master...rosenhouse:gabe-windows-cleanup

@feiskyer
Copy link
Contributor

LGTM

@rosenhouse
Copy link
Contributor

Good suggestion by @squeed: we could add an authors or maintainers file here listing the Microsoft folks.

@rakelkar
Copy link
Contributor

rakelkar commented Aug 29, 2018 via email

@thxCode
Copy link
Contributor Author

thxCode commented Aug 30, 2018

@rosenhouse, fix a mistake from #85 (comment). FYI, @benmoss .

@thxCode thxCode force-pushed the windows_cni branch 3 times, most recently from d82e0a3 to ea2c3b6 Compare August 30, 2018 01:42
@dineshgovindasamy
Copy link

LGTM

@dineshgovindasamy
Copy link

@rosenhouse @benmoss

We have subsequent PR's waiting on this merge. Can we please get this in as all our remaining work is gates on this PR?

@rosenhouse
Copy link
Contributor

Will need a second approval from one of the @containernetworking/cni-maintainers before we can merge.

@benmoss
Copy link
Contributor

benmoss commented Sep 5, 2018

@squeed any chance you can take a look?

@JMesser81
Copy link

@dcbw @squeed @bboreham

Can you please take a look and LGTM so we can get this merged? It's been about a year since we first started this effort and many partner teams are taking a dependency here. We have unit tests added now as well. Thanks!

@daschott
Copy link
Contributor

Thank you @rosenhouse for the support and assistance in this PR and your review 🥇
Also @matthewdupre @squaremo @steveej @tomdee can one of you kindly take a look and LGTM or comment? We'd love to contribute more but our subsequent work depends on this PR being merged first :)

plugins/main/windows/l2bridge/sample.conf Outdated Show resolved Hide resolved
plugins/main/windows/overlay/overlay_windows.go Outdated Show resolved Hide resolved
Copy link
Member

@dcbw dcbw left a comment

Choose a reason for hiding this comment

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

There are a number of review comments that we'd like addressed, but looks like this is on the right track. Thanks!

// NetConf is the CNI spec
type NetConf struct {
types.NetConf
AdditionalArgs []policyArgument `json:"AdditionalArgs,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Need to fix the JSON capitalization:

json:"additionalArgs,omitempty"

types.CommonArgs
K8S_POD_NAMESPACE types.UnmarshallableString `json:"K8S_POD_NAMESPACE,omitempty"`
K8S_POD_NAME types.UnmarshallableString `json:"K8S_POD_NAME,omitempty"`
K8S_POD_INFRA_CONTAINER_ID types.UnmarshallableString `json:"K8S_POD_INFRA_CONTAINER_ID,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

INFRA_CONTAINER_ID isn't used anywhere, so it should be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Same for K8S_POD_NAME

types.CommonArgs
K8S_POD_NAMESPACE types.UnmarshallableString `json:"K8S_POD_NAMESPACE,omitempty"`
K8S_POD_NAME types.UnmarshallableString `json:"K8S_POD_NAME,omitempty"`
K8S_POD_INFRA_CONTAINER_ID types.UnmarshallableString `json:"K8S_POD_INFRA_CONTAINER_ID,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

INFRA_POD_CONTAINER_ID isn't used anywhere so it should be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Same for K8S_POD_NAME

Copy link
Member

Choose a reason for hiding this comment

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

Actually per below, let's remove all the CNI Args stuff for now.


ipAddr := result.IPs[0].Address.IP.To4()
// conjure a MAC based on the IP for Overlay
macAddr := fmt.Sprintf("%v-%02x-%02x-%02x-%02x", n.endpointMacPrefix, ipAddr[0], ipAddr[1], ipAddr[2], ipAddr[3])
Copy link
Member

Choose a reason for hiding this comment

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

This plugin isn't IPv6-ready, is it? That could be a blocker, since all the rest of the CNI Plugins work with IPv6.

cniargs, err := parseCniArgs(args.Args)
k8sNamespace := "default"
if err == nil {
k8sNamespace = string(cniargs.K8S_POD_NAMESPACE)
Copy link
Member

Choose a reason for hiding this comment

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

This is Kubernetes specific, which isn't something we want in CNI since CNI is not Kubernetes-specific and works with other runtimes too. For Kube I believe there are some other solutions that we can explore that don't hardcode Kube-ness into the CNI plugin.

For now, let's remove all the parseCniArgs() and K8S_POD_NAMESPACE stuff and fix that in a follow-up patch.

```
{
"name": "mynet",
"type": "win-l2bridge",
Copy link
Member

Choose a reason for hiding this comment

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

Need to make the type consistent with the actual plugin name, eg when renamed to "win-bridge" need to make this "type": "win-bridge",

## Network configuration reference

* `name` (string, required): the name of the network.
* `type` (string, required): "win-l2bridge".
Copy link
Member

Choose a reason for hiding this comment

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

Need to keep the plugin name consistent with the binary name.


The following fields must be set in the delegated plugin configuration:
* `name` (string, required): the name of the network (must match the name in Flannel config / name of the HNS network)
* `type` (string, optional): set to win-l2bridge by default. Can be set to win-overlay or other custom windows CNI
Copy link
Member

Choose a reason for hiding this comment

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

Need to keep the plugin name consistent with the binary name.

@@ -0,0 +1,27 @@
# L2Bridge plugin (Windows)
Copy link
Member

Choose a reason for hiding this comment

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

This is for the Overlay plugin, right? Not L2Bridge.

```
{
"name": "mynet",
"type": "win-overlay",
Copy link
Member

Choose a reason for hiding this comment

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

Need to keep the type consistent with the binary name, and to match win-bridge, let's rename the binary to "win-overlay".

@thxCode
Copy link
Contributor Author

thxCode commented Sep 13, 2018

@dcbw, @squeed , please review again.

Copy link
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

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

I think this is ok to go in; the main eyebrow-raising points have been addressed.

@thxCode
Copy link
Contributor Author

thxCode commented Sep 19, 2018

@rosenhouse , @dcbw , @squeed , @bboreham , is there any new questions on this PR?

@squeed
Copy link
Member

squeed commented Sep 19, 2018

Changes look good to me, thanks!

One last request - could you squash your commits in to one for /vendor and one for everything else?

@thxCode thxCode force-pushed the windows_cni branch 8 times, most recently from 1125448 to 915374c Compare September 20, 2018 16:33
    (*) github.com/Microsoft/hcsshim
    (*) golang.org/x/sys
    (*) github.com/x/cyrpto
    (*) github.com/sirupsen/logrus
    (*) github.com/Microsoft/go-winio
    (*) github.com/juju/errors
    (*) github.com/buger/jsonparser
Patch for containernetworking#85

+ Windows cni plugins are added
   (*) win-bridge (hostgw)
   (*) win-overlay (vxlan)
+ Windows netconf unit test
+ Fix appveyor config to run the test
+ Build release support for windows plugins

Address comments

From:
    - containernetworking#85
    - rakelkar@0049c64
@dcbw
Copy link
Member

dcbw commented Sep 20, 2018

LGTM, I think the remaining issues can be addressed in follow-up PRs

@dcbw dcbw merged commit a8ad12d into containernetworking:master Sep 20, 2018
@thxCode thxCode deleted the windows_cni branch September 21, 2018 01:20
This was referenced Nov 20, 2018
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.