Browse code

Start SDN controller after running kubelet

On the openshift node,
(a) SDN needs assigned subnet by openshift master
(b) Master can only assign subnet after kubelet registers the node.
(c) On a fresh openshift install, (a) and (b) are in deadlock as SDN will not
proceed without subnet and kubelet will not register the node as
it is blocked on network plugin intialization to finish.

So the fix:
- Block SDN initialization to finish at pod setup time.
- Run kubelet first and it registers the node if needed and
pods may block for sdn initialization (async op).
- Run SDN controller (doesn't need to run asynchronously) after kubelet,
it gets the subnet, does the needed setup and marks sdn as ready.

Ravi Sankar Penta authored on 2015/12/10 06:47:25
Showing 1 changed files
... ...
@@ -262,12 +262,10 @@ func RunSDNController(config *kubernetes.NodeConfig, nodeConfig configapi.NodeCo
262 262
 	if controller != nil {
263 263
 		config.KubeletConfig.NetworkPlugins = append(config.KubeletConfig.NetworkPlugins, controller)
264 264
 
265
-		go func() {
266
-			err := controller.StartNode(nodeConfig.NetworkConfig.MTU)
267
-			if err != nil {
268
-				glog.Fatalf("SDN Node failed: %v", err)
269
-			}
270
-		}()
265
+		err := controller.StartNode(nodeConfig.NetworkConfig.MTU)
266
+		if err != nil {
267
+			glog.Fatalf("SDN Node failed: %v", err)
268
+		}
271 269
 	}
272 270
 
273 271
 	return endpointFilter
... ...
@@ -280,11 +278,11 @@ func StartNode(nodeConfig configapi.NodeConfig) error {
280 280
 	}
281 281
 	glog.Infof("Starting node %s (%s)", config.KubeletServer.HostnameOverride, version.Get().String())
282 282
 
283
-	endpointFilter := RunSDNController(config, nodeConfig)
284 283
 	config.EnsureVolumeDir()
285 284
 	config.EnsureDocker(docker.NewHelper())
286
-	config.RunProxy(endpointFilter)
287 285
 	config.RunKubelet()
286
+	endpointFilter := RunSDNController(config, nodeConfig)
287
+	config.RunProxy(endpointFilter)
288 288
 
289 289
 	return nil
290 290
 }