示例#1
0
func RunSDNController(config *kubernetes.NodeConfig, nodeConfig configapi.NodeConfig) {
	oclient, _, err := configapi.GetOpenShiftClient(nodeConfig.MasterKubeConfig)
	if err != nil {
		glog.Fatal("Failed to get kube client for SDN")
	}

	switch nodeConfig.NetworkConfig.NetworkPluginName {
	case flatsdn.NetworkPluginName():
		ch := make(chan struct{})
		config.KubeletConfig.StartUpdates = ch
		go flatsdn.Node(oclient, config.Client, nodeConfig.NodeName, nodeConfig.NodeIP, ch, nodeConfig.NetworkConfig.MTU)
	case multitenant.NetworkPluginName():
		ch := make(chan struct{})
		config.KubeletConfig.StartUpdates = ch
		plugin := multitenant.GetKubeNetworkPlugin()
		config.KubeletConfig.NetworkPlugins = append(config.KubeletConfig.NetworkPlugins, plugin)
		go multitenant.Node(oclient, config.Client, nodeConfig.NodeName, nodeConfig.NodeIP, ch, plugin, nodeConfig.NetworkConfig.MTU)
	}
}
示例#2
0
func RunSDNController(config *kubernetes.NodeConfig, nodeConfig configapi.NodeConfig) kubernetes.FilteringEndpointsConfigHandler {
	oclient, _, err := configapi.GetOpenShiftClient(nodeConfig.MasterKubeConfig)
	if err != nil {
		glog.Fatal("Failed to get kube client for SDN")
	}
	registry := osdn.NewOsdnRegistryInterface(oclient, config.Client)

	switch nodeConfig.NetworkConfig.NetworkPluginName {
	case flatsdn.NetworkPluginName():
		ch := make(chan struct{})
		config.KubeletConfig.StartUpdates = ch
		go flatsdn.Node(registry, nodeConfig.NodeName, nodeConfig.NodeIP, ch, nodeConfig.NetworkConfig.MTU)
	case multitenant.NetworkPluginName():
		ch := make(chan struct{})
		config.KubeletConfig.StartUpdates = ch
		plugin := multitenant.GetKubeNetworkPlugin()
		config.KubeletConfig.NetworkPlugins = append(config.KubeletConfig.NetworkPlugins, plugin)
		go multitenant.Node(registry, nodeConfig.NodeName, nodeConfig.NodeIP, ch, plugin, nodeConfig.NetworkConfig.MTU)
		return registry
	}
	return nil
}