Fix ordering of SDN startup threads
node.host isn't set until plugin Init() is called, so we have to wait
for that before creating the pod manager.
@@ -204,6 +204,10 @@ func (node *OsdnNode) Start() error {
}
}
+ // Wait for kubelet to init the plugin so we get a knetwork.Host
+ log.V(5).Infof("Waiting for kubelet network plugin initialization")
+ <-node.kubeletInitReady
+
log.V(5).Infof("Creating and initializing openshift-sdn pod manager")
node.podManager, err = newPodManager(node.host, node.multitenant, node.localSubnetCIDR, node.networkInfo, node.kClient, node.vnids, node.mtu)
if err != nil {
@@ -213,10 +217,6 @@ func (node *OsdnNode) Start() error {
return err
}
- // Wait for kubelet to init the plugin so we get a knetwork.Host
- log.V(5).Infof("Waiting for kubelet network plugin initialization")
- <-node.kubeletInitReady
-
if networkChanged {
var pods []kapi.Pod
pods, err = node.GetLocalPods(kapi.NamespaceAll)
