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 basic OVS CNI plugin implementation #4

Merged
merged 1 commit into from
Aug 21, 2018

Conversation

phoracek
Copy link
Member

@phoracek phoracek commented Aug 16, 2018

Resolves #2.

Just connect container to an OVS bridge and give its port specified VLAN ID.

  • Plugin implemented
  • Plugin documentation
  • Example for manual testing
  • Code comments
  • Logging
  • Tests
  • Deployment on local cluster
  • Usage example on the local cluster

@phoracek phoracek self-assigned this Aug 16, 2018
@phoracek phoracek force-pushed the basic-cni branch 8 times, most recently from 88d48ee to bb0f93c Compare August 20, 2018 09:59
@phoracek phoracek changed the title [WIP] add basic OVS CNI plugin implementation add basic OVS CNI plugin implementation Aug 20, 2018
@phoracek
Copy link
Member Author

@dankenigsberg @yuvalif @SchSeba could you please review this? Thanks.

@phoracek phoracek force-pushed the basic-cni branch 2 times, most recently from 27a1558 to 30244ed Compare August 20, 2018 10:07
Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

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

Looks good!
Just a few nits.

* `name` (string, required): the name of the network.
* `type` (string, required): "ovs".
* `bridge` (string, required): name of the bridge to use.
* `vlan` (integer, optional): VLAN ID of attached port. Opened for all if not
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/Opened for all/Trunk port/

# Create a new namespace
ip netns add ns1

# Create OVS bridge on the host
Copy link
Collaborator

Choose a reason for hiding this comment

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

add here how to install ovs or maybe just a note that ovs needs to be installed and running

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


## Go Tests

This plugin also have Go test coverage. To run tests, Open vSwitch must be
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add this to the manual section maybe :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,82 @@
# Usage Example on Local Cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use the provider I already created on the kubevirtci project? (KUBEVIRT_PROVIDER=k8s-multus-1.11.1)

Then the cluster-sync only needs to deploy the ovs plugin daemonset.

Copy link
Member Author

@phoracek phoracek Aug 21, 2018

Choose a reason for hiding this comment

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

Done


if netconf.BrName == "" {
return nil, fmt.Errorf("\"bridge\" is a required argument")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also can we make a vlan validation?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is later validated by ovs-vsctl ovs-vsctl: constraint violation: 5555 is not in the valid range 0 to 4095 (inclusive), I think we should validate only necessary minimum, but I'm open to discuss it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok works for me.

Just connect container to an OVS bridge and give its port specified
VLAN ID.
Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks and good job!

@phoracek phoracek merged commit 7865d93 into k8snetworkplumbingwg:master Aug 21, 2018
@phoracek
Copy link
Member Author

@SchSeba thanks a lot

// this ensures that main runs only on main thread (thread group leader).
// since namespace ops (unshare, setns) are done for a single thread, we
// must ensure that the goroutine does not jump from OS thread to thread
runtime.LockOSThread()
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do you use network actions inside goroutines?

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.

3 participants