Browse code

Update for import/reorg of openshift-sdn code

Dan Winship authored on 2016/06/24 20:59:28
Showing 12 changed files
... ...
@@ -10,8 +10,7 @@ os::provision::install-sdn() {
10 10
     mkdir -p ${target}
11 11
   fi
12 12
 
13
-  local osdn_base_path="${deployed_root}/Godeps/_workspace/src/github.com/openshift/openshift-sdn"
14
-  local osdn_plugin_path="${osdn_base_path}/plugins/osdn"
13
+  local osdn_plugin_path="${deployed_root}/pkg/sdn/plugin"
15 14
   mkdir -p "${target}/bin/"
16 15
   pushd "${osdn_plugin_path}" > /dev/null
17 16
     install bin/openshift-sdn-ovs "${target}/bin/"
... ...
@@ -5,7 +5,6 @@
5 5
 
6 6
 %global gopath      %{_datadir}/gocode
7 7
 %global import_path github.com/openshift/origin
8
-%global sdn_import_path github.com/openshift/openshift-sdn
9 8
 # The following should only be used for cleanup of sdn-ovs upgrades
10 9
 %global kube_plugin_path /usr/libexec/kubernetes/kubelet-plugins/net/exec/redhat~openshift-ovs-subnet
11 10
 
... ...
@@ -283,7 +282,7 @@ mkdir -p %{buildroot}%{_sharedstatedir}/origin
283 283
 # Install sdn scripts
284 284
 install -d -m 0755 %{buildroot}%{_unitdir}/docker.service.d
285 285
 install -p -m 0644 contrib/systemd/docker-sdn-ovs.conf %{buildroot}%{_unitdir}/docker.service.d/
286
-pushd _thirdpartyhacks/src/%{sdn_import_path}/plugins/osdn/bin
286
+pushd pkg/sdn/plugin/bin
287 287
    install -p -m 755 openshift-sdn-ovs %{buildroot}%{_bindir}/openshift-sdn-ovs
288 288
    install -p -m 755 openshift-sdn-docker-setup.sh %{buildroot}%{_bindir}/openshift-sdn-docker-setup.sh
289 289
 popd
... ...
@@ -6,10 +6,10 @@ import (
6 6
 
7 7
 	"github.com/spf13/cobra"
8 8
 
9
-	"github.com/openshift/openshift-sdn/pkg/cmd/admin/network"
10 9
 	"github.com/openshift/origin/pkg/cmd/admin/cert"
11 10
 	diagnostics "github.com/openshift/origin/pkg/cmd/admin/diagnostics"
12 11
 	"github.com/openshift/origin/pkg/cmd/admin/groups"
12
+	"github.com/openshift/origin/pkg/cmd/admin/network"
13 13
 	"github.com/openshift/origin/pkg/cmd/admin/node"
14 14
 	"github.com/openshift/origin/pkg/cmd/admin/policy"
15 15
 	"github.com/openshift/origin/pkg/cmd/admin/project"
... ...
@@ -27,8 +27,6 @@ import (
27 27
 	kcrypto "k8s.io/kubernetes/pkg/util/crypto"
28 28
 	kerrors "k8s.io/kubernetes/pkg/util/errors"
29 29
 
30
-	"github.com/openshift/openshift-sdn/plugins/osdn"
31
-	osdnapi "github.com/openshift/openshift-sdn/plugins/osdn/api"
32 30
 	osclient "github.com/openshift/origin/pkg/client"
33 31
 	configapi "github.com/openshift/origin/pkg/cmd/server/api"
34 32
 	"github.com/openshift/origin/pkg/cmd/server/crypto"
... ...
@@ -38,6 +36,8 @@ import (
38 38
 	"github.com/openshift/origin/pkg/cmd/util/variable"
39 39
 	"github.com/openshift/origin/pkg/dns"
40 40
 	sdnapi "github.com/openshift/origin/pkg/sdn/api"
41
+	sdnplugin "github.com/openshift/origin/pkg/sdn/plugin"
42
+	sdnpluginapi "github.com/openshift/origin/pkg/sdn/plugin/api"
41 43
 )
42 44
 
43 45
 // NodeConfig represents the required parameters to start the OpenShift node
... ...
@@ -76,9 +76,9 @@ type NodeConfig struct {
76 76
 	DNSServer *dns.Server
77 77
 
78 78
 	// SDNPlugin is an optional SDN plugin
79
-	SDNPlugin osdnapi.OsdnNodePlugin
79
+	SDNPlugin sdnpluginapi.OsdnNodePlugin
80 80
 	// EndpointsFilterer is an optional endpoints filterer
81
-	FilteringEndpointsHandler osdnapi.FilteringEndpointsConfigHandler
81
+	FilteringEndpointsHandler sdnpluginapi.FilteringEndpointsConfigHandler
82 82
 }
83 83
 
84 84
 func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enableDNS bool) (*NodeConfig, error) {
... ...
@@ -171,7 +171,7 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable
171 171
 		server.ResolverConfig = ""
172 172
 	}
173 173
 
174
-	if osdn.IsOpenShiftNetworkPlugin(server.NetworkPluginName) {
174
+	if sdnplugin.IsOpenShiftNetworkPlugin(server.NetworkPluginName) {
175 175
 		// set defaults for openshift-sdn
176 176
 		server.HairpinMode = componentconfig.HairpinNone
177 177
 		server.ConfigureCBR0 = false
... ...
@@ -275,7 +275,7 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable
275 275
 	if err != nil {
276 276
 		return nil, fmt.Errorf("Cannot parse the provided ip-tables sync period (%s) : %v", options.IPTablesSyncPeriod, err)
277 277
 	}
278
-	sdnPlugin, err := osdn.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.NodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU)
278
+	sdnPlugin, err := sdnplugin.NewNodePlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient, options.NodeName, options.NodeIP, iptablesSyncPeriod, options.NetworkConfig.MTU)
279 279
 	if err != nil {
280 280
 		return nil, fmt.Errorf("SDN initialization failed: %v", err)
281 281
 	}
... ...
@@ -283,7 +283,7 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable
283 283
 		cfg.NetworkPlugins = append(cfg.NetworkPlugins, sdnPlugin)
284 284
 	}
285 285
 
286
-	endpointFilter, err := osdn.NewProxyPlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient)
286
+	endpointFilter, err := sdnplugin.NewProxyPlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient)
287 287
 	if err != nil {
288 288
 		return nil, fmt.Errorf("SDN proxy initialization failed: %v", err)
289 289
 	}
... ...
@@ -413,7 +413,7 @@ func buildKubeProxyConfig(options configapi.NodeConfig) (*proxyoptions.ProxyServ
413 413
 }
414 414
 
415 415
 func validateAndGetNetworkPluginName(originClient *osclient.Client, pluginName string) (string, error) {
416
-	if osdn.IsOpenShiftNetworkPlugin(pluginName) {
416
+	if sdnplugin.IsOpenShiftNetworkPlugin(pluginName) {
417 417
 		// Detect any plugin mismatches between node and master
418 418
 		clusterNetwork, err := originClient.ClusterNetwork().Get(sdnapi.ClusterNetworkDefault)
419 419
 		if kerrs.IsNotFound(err) {
... ...
@@ -47,12 +47,12 @@ import (
47 47
 	"github.com/openshift/origin/pkg/security/uidallocator"
48 48
 	servingcertcontroller "github.com/openshift/origin/pkg/service/controller/servingcert"
49 49
 
50
-	"github.com/openshift/openshift-sdn/plugins/osdn"
51 50
 	configapi "github.com/openshift/origin/pkg/cmd/server/api"
52 51
 	"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
53 52
 	imageapi "github.com/openshift/origin/pkg/image/api"
54 53
 	quota "github.com/openshift/origin/pkg/quota"
55 54
 	quotacontroller "github.com/openshift/origin/pkg/quota/controller"
55
+	sdnplugin "github.com/openshift/origin/pkg/sdn/plugin"
56 56
 	serviceaccountcontrollers "github.com/openshift/origin/pkg/serviceaccounts/controllers"
57 57
 )
58 58
 
... ...
@@ -380,7 +380,7 @@ func (c *MasterConfig) RunDeploymentImageChangeTriggerController() {
380 380
 // RunSDNController runs openshift-sdn if the said network plugin is provided
381 381
 func (c *MasterConfig) RunSDNController() {
382 382
 	oClient, kClient := c.SDNControllerClients()
383
-	if err := osdn.StartMaster(c.Options.NetworkConfig, oClient, kClient); err != nil {
383
+	if err := sdnplugin.StartMaster(c.Options.NetworkConfig, oClient, kClient); err != nil {
384 384
 		glog.Fatalf("SDN initialization failed: %v", err)
385 385
 	}
386 386
 }
... ...
@@ -15,7 +15,6 @@ import (
15 15
 	kerrors "k8s.io/kubernetes/pkg/api/errors"
16 16
 	kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
17 17
 
18
-	"github.com/openshift/openshift-sdn/plugins/osdn"
19 18
 	"github.com/openshift/origin/pkg/cmd/server/admin"
20 19
 	configapi "github.com/openshift/origin/pkg/cmd/server/api"
21 20
 	configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest"
... ...
@@ -23,6 +22,7 @@ import (
23 23
 	cmdutil "github.com/openshift/origin/pkg/cmd/util"
24 24
 	"github.com/openshift/origin/pkg/cmd/util/docker"
25 25
 	utilflags "github.com/openshift/origin/pkg/cmd/util/flags"
26
+	sdnplugin "github.com/openshift/origin/pkg/sdn/plugin"
26 27
 	"github.com/openshift/origin/pkg/version"
27 28
 )
28 29
 
... ...
@@ -288,7 +288,7 @@ func StartNode(nodeConfig configapi.NodeConfig, components *utilflags.ComponentF
288 288
 
289 289
 	// In case of openshift network plugin, nodeConfig.networkPluginName is optional and is auto detected/finalized
290 290
 	// once we build kubernetes node config. So perform plugin name related check here.
291
-	if osdn.IsOpenShiftNetworkPlugin(config.KubeletServer.NetworkPluginName) {
291
+	if sdnplugin.IsOpenShiftNetworkPlugin(config.KubeletServer.NetworkPluginName) {
292 292
 		// TODO: SDN plugin depends on the Kubelet registering as a Node and doesn't retry cleanly,
293 293
 		// and Kubelet also can't start the PodSync loop until the SDN plugin has loaded.
294 294
 		if components.Enabled(ComponentKubelet) != components.Enabled(ComponentPlugins) {
... ...
@@ -10,10 +10,10 @@ import (
10 10
 
11 11
 	"github.com/golang/glog"
12 12
 
13
-	"github.com/openshift/openshift-sdn/pkg/ipcmd"
14
-	"github.com/openshift/openshift-sdn/pkg/netutils"
15
-	"github.com/openshift/openshift-sdn/pkg/ovs"
16 13
 	osapi "github.com/openshift/origin/pkg/sdn/api"
14
+	"github.com/openshift/origin/pkg/util/ipcmd"
15
+	"github.com/openshift/origin/pkg/util/netutils"
16
+	"github.com/openshift/origin/pkg/util/ovs"
17 17
 
18 18
 	kapi "k8s.io/kubernetes/pkg/api"
19 19
 	kexec "k8s.io/kubernetes/pkg/util/exec"
... ...
@@ -6,10 +6,9 @@ import (
6 6
 
7 7
 	log "github.com/golang/glog"
8 8
 
9
-	"github.com/openshift/openshift-sdn/pkg/netutils"
10
-
11 9
 	osclient "github.com/openshift/origin/pkg/client"
12 10
 	osconfigapi "github.com/openshift/origin/pkg/cmd/server/api"
11
+	"github.com/openshift/origin/pkg/util/netutils"
13 12
 
14 13
 	kclient "k8s.io/kubernetes/pkg/client/unversioned"
15 14
 	kerrors "k8s.io/kubernetes/pkg/util/errors"
... ...
@@ -7,11 +7,10 @@ import (
7 7
 
8 8
 	log "github.com/golang/glog"
9 9
 
10
-	"github.com/openshift/openshift-sdn/pkg/netutils"
11
-	"github.com/openshift/openshift-sdn/plugins/osdn/api"
12
-
13 10
 	osclient "github.com/openshift/origin/pkg/client"
14 11
 	osapi "github.com/openshift/origin/pkg/sdn/api"
12
+	"github.com/openshift/origin/pkg/sdn/plugin/api"
13
+	"github.com/openshift/origin/pkg/util/netutils"
15 14
 
16 15
 	kapi "k8s.io/kubernetes/pkg/api"
17 16
 	kclient "k8s.io/kubernetes/pkg/client/unversioned"
... ...
@@ -8,9 +8,8 @@ import (
8 8
 
9 9
 	"github.com/golang/glog"
10 10
 
11
-	"github.com/openshift/openshift-sdn/plugins/osdn/api"
12
-
13 11
 	osclient "github.com/openshift/origin/pkg/client"
12
+	"github.com/openshift/origin/pkg/sdn/plugin/api"
14 13
 
15 14
 	kapi "k8s.io/kubernetes/pkg/api"
16 15
 	kclient "k8s.io/kubernetes/pkg/client/unversioned"
... ...
@@ -14,8 +14,8 @@ import (
14 14
 	utilwait "k8s.io/kubernetes/pkg/util/wait"
15 15
 	"k8s.io/kubernetes/pkg/watch"
16 16
 
17
-	"github.com/openshift/openshift-sdn/pkg/netutils"
18 17
 	osapi "github.com/openshift/origin/pkg/sdn/api"
18
+	"github.com/openshift/origin/pkg/util/netutils"
19 19
 )
20 20
 
21 21
 func (master *OsdnMaster) SubnetStartMaster(clusterNetwork *net.IPNet, hostSubnetLength uint) error {
... ...
@@ -16,8 +16,8 @@ import (
16 16
 	utilwait "k8s.io/kubernetes/pkg/util/wait"
17 17
 	"k8s.io/kubernetes/pkg/watch"
18 18
 
19
-	"github.com/openshift/openshift-sdn/pkg/netutils"
20 19
 	osapi "github.com/openshift/origin/pkg/sdn/api"
20
+	"github.com/openshift/origin/pkg/util/netutils"
21 21
 )
22 22
 
23 23
 const (