Example #1
0
func Node(osClient *osclient.Client, kClient *kclient.Client, hostname string, publicIP string, ready chan struct{}) {
	osdnInterface := newOsdnRegistryInterface(osClient, kClient)
	kc, err := ovssubnet.NewKubeController(&osdnInterface, hostname, publicIP, ready)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
	kc.StartNode(false, false)
}
Example #2
0
func Master(osClient *osclient.Client, kClient *kclient.Client, clusterNetwork string, clusterNetworkLength uint) {
	osdnInterface := 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.NewKubeController(&osdnInterface, host, "", nil)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
	err = kc.StartMaster(false, clusterNetwork, clusterNetworkLength)
	if err != nil {
		glog.Fatalf("SDN initialization failed: %v", err)
	}
}
Example #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)
}