hyperhq / runv

Hypervisor-based Runtime for OCI
Apache License 2.0
828 stars 129 forks source link

Proposal: support CNI network plugins #591

Open WeiZhang555 opened 7 years ago

WeiZhang555 commented 7 years ago

Currently runv master can't operate with CNI network plugins, I think we should add some network operation interfaces for runv to make it work with CNI. Interfaces could be like this:

Commands:
    interface   manage network interface
    route       manage route

1. runv interface

Subcommands:
    add add an interface into a container
    rm  remove an interface from a container
    update  update configuration of an interface
    ls  list network interfaces in an container
    inspect show configuration of a specific network interface from a container

1.1. add

usage: add container
flags:
    --tapname   use existing tap device in host, tap will be created for you if empty
    --name      set interface name in container
    --ip        set ip address with a mask, format: 192.168.0.2/24
    --mac       set mac address 
    --mtu       set mtu

1.2. rm

Usage: rm container name - rename interface "name" from container "container"
flags:

1.3 update

Usage: update container interface - update configuration of interface "interface" in a container
flags:
    --name      set interface name in container
    --add-ip    add one more ip address with a mask, format: 192.168.0.2/24
    --rm-ip     remove one ip address from a container, format: 192.168.0.2/24
    --mac       set mac address 
    --mtu       set mtu

1.4 ls

Usage: ls container - list all interfaces in a container

2. runv route

Subcommand:
    add add route into a container
    rm  remove route from container
        ls      list all route rules in a container

2.1 add

Usage: add container route - add route rule into a container
flags:
    --dest      the destination prefix of the route
    --dev       the output device name
    --src       the source address to prefer when sending to the destinations covered by the route prefix.
    --gateway   the address of the nexthop router

2.2 rm

Usage: remove container route - remove route rule from container, "route" is destination prefix of the route

2.3 ls

Usage: ls container - list all route rules in a container