From 3de63ee756f9d7c0a4524b40a89e92b918a9249f Mon Sep 17 00:00:00 2001 From: Kuralamudhan Ramakrishnan Date: Tue, 21 Apr 2020 17:19:34 +0000 Subject: 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 Change-Id: I1e2b114d90f717baa2ee94ff379c849d73b2754e --- cmd/nfn-agent/nfn-agent.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cmd/nfn-agent/nfn-agent.go') diff --git a/cmd/nfn-agent/nfn-agent.go b/cmd/nfn-agent/nfn-agent.go index 3c85dbd..8d33778 100644 --- a/cmd/nfn-agent/nfn-agent.go +++ b/cmd/nfn-agent/nfn-agent.go @@ -9,8 +9,11 @@ import ( "os" "os/signal" pb "ovn4nfv-k8s-plugin/internal/pkg/nfnNotify/proto" + cs "ovn4nfv-k8s-plugin/internal/pkg/cniserver" "ovn4nfv-k8s-plugin/internal/pkg/ovn" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" "strings" "syscall" "time" @@ -298,6 +301,26 @@ func main() { client := pb.NewNfnNotifyClient(conn) errorChannel = make(chan string) + // creates the in-cluster config + config, err := rest.InClusterConfig() + if err != nil { + log.Error(err, "Unable to create in-cluster config") + return + } + + // creates the clientset + clientset, err := kubernetes.NewForConfig(config) + if err != nil { + log.Error(err, "Unable to create clientset for in-cluster config") + return + } + + cniserver := cs.NewCNIServer("",clientset) + err = cniserver.Start(cs.HandleCNIcommandRequest) + if err != nil { + log.Error(err, "Unable to start cni server") + return + } // Run client in background go subscribeNotif(client) shutdownHandler(errorChannel) -- cgit