@@ -4,10 +4,7 @@ package node
44
55import (
66 "fmt"
7- "io/ioutil"
87 "net"
9- "os"
10- "path/filepath"
118 "strings"
129 "sync"
1310 "time"
@@ -47,10 +44,7 @@ import (
4744 "github.com/openshift/origin/pkg/util/ovs"
4845)
4946
50- const (
51- openshiftCNIFile = "80-openshift-network.conf"
52- hostLocalDataDir = "/var/lib/cni/networks"
53- )
47+ const hostLocalDataDir = "/var/lib/cni/networks"
5448
5549type osdnPolicy interface {
5650 Name () string
@@ -77,7 +71,6 @@ type OsdnNodeConfig struct {
7771 MTU uint32
7872 EnableHostports bool
7973 CNIBinDir string
80- CNIConfDir string
8174
8275 NetworkClient networkclient.Interface
8376 KClient kubernetes.Interface
@@ -105,7 +98,6 @@ type OsdnNode struct {
10598 useConnTrack bool
10699 iptablesSyncPeriod time.Duration
107100 mtu uint32
108- cniDirPath string
109101
110102 // Synchronizes operations on egressPolicies
111103 egressPoliciesLock sync.Mutex
@@ -151,10 +143,6 @@ func New(c *OsdnNodeConfig) (*OsdnNode, error) {
151143 return nil , fmt .Errorf ("%q plugin is not compatible with proxy-mode %q" , c .PluginName , c .ProxyMode )
152144 }
153145
154- // If our CNI config file exists, remove it so that kubelet doesn't think
155- // we're ready yet
156- os .Remove (filepath .Join (c .CNIConfDir , openshiftCNIFile ))
157-
158146 if err := c .setNodeIP (); err != nil {
159147 return nil , err
160148 }
@@ -182,7 +170,6 @@ func New(c *OsdnNodeConfig) (*OsdnNode, error) {
182170 kubeInformers : c .KubeInformers ,
183171 networkInformers : c .NetworkInformers ,
184172 egressIP : newEgressIPWatcher (oc , c .SelfIP , c .MasqueradeBit ),
185- cniDirPath : c .CNIConfDir ,
186173
187174 runtimeEndpoint : c .RuntimeEndpoint ,
188175 // 2 minutes is the current default value used in kubelet
@@ -337,34 +324,11 @@ func (node *OsdnNode) Start() error {
337324 }
338325 }
339326
340- if err := os .MkdirAll (node .cniDirPath , 0755 ); err != nil {
341- return err
342- }
343-
344327 go kwait .Forever (node .policy .SyncVNIDRules , time .Hour )
345328 go kwait .Forever (func () {
346329 gatherPeriodicMetrics (node .oc .ovs )
347330 }, time .Minute * 2 )
348331
349- klog .V (2 ).Infof ("openshift-sdn network plugin registering startup" )
350-
351- // Make an event that openshift-sdn started
352- node .recorder .Eventf (& corev1.ObjectReference {Kind : "Node" , Name : node .hostName }, corev1 .EventTypeNormal , "Starting" , "Starting openshift-sdn." )
353-
354- // Write our CNI config file out to disk to signal to kubelet that
355- // our network plugin is ready
356- err = ioutil .WriteFile (filepath .Join (node .cniDirPath , openshiftCNIFile ), []byte (`
357- {
358- "cniVersion": "0.3.1",
359- "name": "openshift-sdn",
360- "type": "openshift-sdn"
361- }
362- ` ), 0644 )
363- if err != nil {
364- return err
365- }
366-
367- klog .V (2 ).Infof ("openshift-sdn network plugin ready" )
368332 return nil
369333}
370334
0 commit comments