{"id":19364629,"url":"https://github.com/john-lin/ovs-cni","last_synced_at":"2025-10-29T02:39:55.524Z","repository":{"id":57550214,"uuid":"106674751","full_name":"John-Lin/ovs-cni","owner":"John-Lin","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-04T15:08:43.000Z","size":154,"stargazers_count":25,"open_issues_count":6,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-06-21T04:26:54.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/John-Lin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-12T09:47:38.000Z","updated_at":"2023-12-19T17:41:16.000Z","dependencies_parsed_at":"2022-09-10T06:10:37.711Z","dependency_job_id":null,"html_url":"https://github.com/John-Lin/ovs-cni","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/John-Lin%2Fovs-cni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/John-Lin%2Fovs-cni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/John-Lin%2Fovs-cni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/John-Lin%2Fovs-cni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/John-Lin","download_url":"https://codeload.github.com/John-Lin/ovs-cni/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223926654,"owners_count":17226443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T07:37:52.050Z","updated_at":"2025-10-29T02:39:50.472Z","avatar_url":"https://github.com/John-Lin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ovs-cni\n\n[![Build Status](https://api.travis-ci.org/John-Lin/ovs-cni.svg?branch=master)](https://travis-ci.org/John-Lin/ovs-cni)\n[![codecov](https://codecov.io/gh/John-Lin/ovs-cni/branch/master/graph/badge.svg)](https://codecov.io/gh/John-Lin/ovs-cni)\n\n## Introduction\n\nOVS-CNI is a totally Open vSwitch CNI plugin, it create the Open vSwitch and use veth to connect the OpenvSwitch and container.\n\novs-cni supports the following options in its config and you can see the example config `example/example.conf` to learn how to use it.\n\n1. controller IP\n\n```\ncontroller:10.245.1.5:6653\n```\n\n2. target vxlan IP\n\n```\nvtepIPs: [\n    \"10.245.2.2\",\n    \"10.245.2.3\"\n]\n```\n\n3. bridge name\n\n```\novsBridge: \"br0\"\n```\n\n4. Act as a gateway for pods.\n\n```\nisDefaultGateway: true\n```\n\n5. Support SNAT for pods traffic.\n\n```\nipMasq: true\n```\n\n6. IPAM support\n\novs-cni support basic IPAM type such as host-local, you can see `example/example.conf` to see how config it.\nBesides, ovs-cni provide a new IPAM plugin central-ip, which use the `ETCD` to perform centralized IP assignment/management and you can go to `ipam/centralip` directory to see more usage about it.\n\n## Usage\n\nIf you are familiar with CNI plugin and know how to use it. you can refer to the following instruction to use it.\nOtherwise you can go to `deployment` directory to learn how to use it.\n\n### Building ovs-cni\n\nBecause ovs-cni used the package management tool called `govendor`, we have to install the govendor first.\n\n```\n$ go get -u github.com/kardianos/govendor\n```\n\nWe use `govendor` to download all dependencies\n\n```\n$ cd ~/go/src/github.com/John-Lin/ovs-cni\n$ govendor sync\n```\n\nbuild the ovs-cni binary.\n\n```\n$ ./build.sh\n```\nand the binary will come out in the `/bin` directory and you can find `ovs` and `centralip`.\nThe `ovs` is the main CNI plugin and the `centralip` is the CNI plugin for different IPAM usage.\nIf you want to use `ETCD` to centralizaed manage the IP address, you should also copy the `centralip` binary to the CNI directory and modify the config to use it.\n\n```\n$ sudo ip netns add ns1\n\n$ sudo CNI_COMMAND=ADD CNI_CONTAINERID=ns1 CNI_NETNS=/var/run/netns/ns1 CNI_IFNAME=eth2 CNI_PATH=`pwd` ./ovs \u003cexample.conf\n```\n\n## Use the ovs-cni\n\nBefore running the ovs-cni, make sure your system meet the following requirement.\n\n1. install openvswitch and run it.\n\n2. download the basic cni binary (local-host) and put they in `/opt/cni/bin`\n\nNow, we use `ip netns` to create a basic network namespace as our example.\n\n```\n$ sudo ip netns add ns1\n```\n\nchange directory to bin and type following command to start the ovs-cni.\n\n```\n$ sudo CNI_COMMAND=DEL CNI_CONTAINERID=ns1 CNI_NETNS=/var/run/netns/ns1 CNI_IFNAME=eth2 CNI_PATH=/opt/cni/bin ./ovs \u003c ../example/example.conf\n$ sudo ip netns exec ns1 ifconfig\n```\n\n## Cleanup\n\n```\n$ sudo ip netns del ns1\n\n$ sudo ovs-vsctl del-br br0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn-lin%2Fovs-cni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohn-lin%2Fovs-cni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn-lin%2Fovs-cni/lists"}