diff options
author | 2020-04-21 17:19:34 +0000 | |
---|---|---|
committer | 2020-09-17 16:25:10 -0700 | |
commit | 3de63ee756f9d7c0a4524b40a89e92b918a9249f (patch) | |
tree | 3579bc50aee0a38d7c63c5787fca6205ced7a2df /cmd/ovn4nfvk8s-cni/app | |
parent | 7f01772cdf3916026a93e9e9ac5ce54d57401476 (diff) |
Adding cnishim and cniserver
- inspired from ovn-kubernetes and sdn openshift - cniserver & cnishim concepts
- removed cni binary to depend on the host ovs binary installation
- encapsulated all the binaries within the ovn and ovs containers
- ovn4nfv-k8s cni server run along with nfn-agent
- cnishim act as the httpclient and cniserver as httpservers
- cnishim wrap all the cni commands to cniserver
- cniserver do the actual network pumping work and send result back to cnishim
- cnishim print the results as per the cni spec requirement
- currently supports only debian installation for ovn daemon
- support for debian kernel installation
- Consolidated all yaml into single ovn4nfv-k8s-plugin
Signed-off-by: Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Change-Id: I1e2b114d90f717baa2ee94ff379c849d73b2754e
Diffstat (limited to 'cmd/ovn4nfvk8s-cni/app')
-rw-r--r-- | cmd/ovn4nfvk8s-cni/app/helper_linux.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/cmd/ovn4nfvk8s-cni/app/helper_linux.go b/cmd/ovn4nfvk8s-cni/app/helper_linux.go index 2dba628..1702597 100644 --- a/cmd/ovn4nfvk8s-cni/app/helper_linux.go +++ b/cmd/ovn4nfvk8s-cni/app/helper_linux.go @@ -10,8 +10,6 @@ import ( "strings" "github.com/sirupsen/logrus" - - "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/types/current" "github.com/containernetworking/plugins/pkg/ip" "github.com/containernetworking/plugins/pkg/ns" @@ -106,10 +104,10 @@ func setupInterface(netns ns.NetNS, containerID, ifName, macAddress, ipAddress, } // ConfigureInterface sets up the container interface -var ConfigureInterface = func(args *skel.CmdArgs, namespace, podName, macAddress, ipAddress, gatewayIP, interfaceName, defaultGateway string, idx, mtu int) ([]*current.Interface, error) { - netns, err := ns.GetNS(args.Netns) +var ConfigureInterface = func(containerNetns, containerID, ifName, namespace, podName, macAddress, ipAddress, gatewayIP, interfaceName, defaultGateway string, idx, mtu int) ([]*current.Interface, error) { + netns, err := ns.GetNS(containerNetns) if err != nil { - return nil, fmt.Errorf("failed to open netns %q: %v", args.Netns, err) + return nil, fmt.Errorf("failed to open netns %q: %v", containerNetns, err) } defer netns.Close() @@ -118,10 +116,10 @@ var ConfigureInterface = func(args *skel.CmdArgs, namespace, podName, macAddress ifaceID = fmt.Sprintf("%s_%s_%s", namespace, podName, interfaceName) } else { ifaceID = fmt.Sprintf("%s_%s", namespace, podName) - interfaceName = args.IfName + interfaceName = ifName defaultGateway = "true" } - hostIface, contIface, err := setupInterface(netns, args.ContainerID, interfaceName, macAddress, ipAddress, gatewayIP, defaultGateway, idx, mtu) + hostIface, contIface, err := setupInterface(netns, containerID, interfaceName, macAddress, ipAddress, gatewayIP, defaultGateway, idx, mtu) if err != nil { return nil, err } @@ -132,7 +130,7 @@ var ConfigureInterface = func(args *skel.CmdArgs, namespace, podName, macAddress fmt.Sprintf("external_ids:attached_mac=%s", macAddress), fmt.Sprintf("external_ids:iface-id=%s", ifaceID), fmt.Sprintf("external_ids:ip_address=%s", ipAddress), - fmt.Sprintf("external_ids:sandbox=%s", args.ContainerID), + fmt.Sprintf("external_ids:sandbox=%s", containerID), } var out []byte @@ -160,10 +158,10 @@ func setupRoute(netns ns.NetNS, dst, gw, dev string) error { } // ConfigureRoute sets up the container routes -var ConfigureRoute = func(args *skel.CmdArgs, dst, gw, dev string) error { - netns, err := ns.GetNS(args.Netns) +var ConfigureRoute = func(containerNetns, dst, gw, dev string) error { + netns, err := ns.GetNS(containerNetns) if err != nil { - return fmt.Errorf("failed to open netns %q: %v", args.Netns, err) + return fmt.Errorf("failed to open netns %q: %v", containerNetns, err) } defer netns.Close() err = setupRoute(netns, dst, gw, dev) |