Esempio n. 1
0
func Node(osClient *osclient.Client, kClient *kclient.Client, hostname string, publicIP string, ready chan struct{}, plugin knetwork.NetworkPlugin, mtu uint) {
	mp, ok := plugin.(*MultitenantPlugin)
	if !ok {
		glog.Fatalf("Failed to type cast provided plugin to a multitenant type plugin")
	}
	osdnInterface := osdn.NewOsdnRegistryInterface(osClient, kClient)
	kc, err := ovssubnet.NewMultitenantController(&osdnInterface, hostname, publicIP, ready)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
	mp.OvsController = kc
	err = kc.StartNode(false, false, mtu)
	if err != nil {
		glog.Fatalf("SDN Node failed: %v", err)
	}
}
Esempio n. 2
0
func Master(osClient *osclient.Client, kClient *kclient.Client, clusterNetwork string, clusterNetworkLength uint, serviceNetwork string) {
	osdnInterface := osdn.NewOsdnRegistryInterface(osClient, kClient)

	// get hostname from the gateway
	output, err := exec.New().Command("hostname", "-f").CombinedOutput()
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
	host := strings.TrimSpace(string(output))

	kc, err := ovssubnet.NewMultitenantController(&osdnInterface, host, "", nil)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
	err = kc.StartMaster(false, clusterNetwork, clusterNetworkLength, serviceNetwork)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
}
Esempio n. 3
0
func newNetworkManager() (NetworkManager, error) {
	sub, err := newSubnetRegistry()
	if err != nil {
		return nil, err
	}
	host := opts.hostname
	if host == "" {
		output, err := exec.Command("hostname", "-f").CombinedOutput()
		if err != nil {
			return nil, err
		}
		host = strings.TrimSpace(string(output))
	}

	if opts.kube {
		return ovssubnet.NewKubeController(sub, string(host), opts.ip, nil)
	} else {
		if opts.multitenant {
			return ovssubnet.NewMultitenantController(sub, string(host), opts.ip, nil)
		}
	}
	// default OVS controller
	return ovssubnet.NewDefaultController(sub, string(host), opts.ip, nil)
}