From 17e42be8dc2ea4a2e41b1bea4b1d07437f977705 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 8 Jul 2017 10:19:27 -0400 Subject: [PATCH 1/3] Split out pkg/sdn/common with code shared between node/master --- pkg/sdn/{plugin => common}/common.go | 18 ++++++------- pkg/sdn/{plugin => common}/common_test.go | 6 ++--- pkg/sdn/{plugin => common}/dns.go | 2 +- pkg/sdn/{plugin => common}/dns_test.go | 2 +- pkg/sdn/common/doc.go | 2 ++ pkg/sdn/{plugin => common}/egress_dns.go | 8 +++--- pkg/sdn/{plugin => common}/eventqueue.go | 2 +- pkg/sdn/{plugin => common}/eventqueue_test.go | 2 +- pkg/sdn/plugin/egress_network_policy.go | 5 ++-- pkg/sdn/plugin/master.go | 15 +++++------ pkg/sdn/plugin/master_test.go | 5 ++-- pkg/sdn/plugin/networkpolicy.go | 25 ++++++++++--------- pkg/sdn/plugin/node.go | 15 +++++------ pkg/sdn/plugin/ovscontroller.go | 5 ++-- pkg/sdn/plugin/proxy.go | 17 +++++++------ pkg/sdn/plugin/sdn_controller.go | 7 +++--- pkg/sdn/plugin/subnets.go | 25 ++++++++++--------- pkg/sdn/plugin/vnids_master.go | 7 +++--- pkg/sdn/plugin/vnids_node.go | 3 ++- 19 files changed, 92 insertions(+), 79 deletions(-) rename pkg/sdn/{plugin => common}/common.go (94%) rename pkg/sdn/{plugin => common}/common_test.go (97%) rename pkg/sdn/{plugin => common}/dns.go (99%) rename pkg/sdn/{plugin => common}/dns_test.go (99%) create mode 100644 pkg/sdn/common/doc.go rename pkg/sdn/{plugin => common}/egress_dns.go (95%) rename pkg/sdn/{plugin => common}/eventqueue.go (99%) rename pkg/sdn/{plugin => common}/eventqueue_test.go (99%) diff --git a/pkg/sdn/plugin/common.go b/pkg/sdn/common/common.go similarity index 94% rename from pkg/sdn/plugin/common.go rename to pkg/sdn/common/common.go index c76f4ba9418b..666a7512b846 100644 --- a/pkg/sdn/plugin/common.go +++ b/pkg/sdn/common/common.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "fmt" @@ -23,11 +23,11 @@ import ( kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion" ) -func hostSubnetToString(subnet *osapi.HostSubnet) string { +func HostSubnetToString(subnet *osapi.HostSubnet) string { return fmt.Sprintf("%s (host: %q, ip: %q, subnet: %q)", subnet.Name, subnet.Host, subnet.HostIP, subnet.Subnet) } -func clusterNetworkToString(n *osapi.ClusterNetwork) string { +func ClusterNetworkToString(n *osapi.ClusterNetwork) string { return fmt.Sprintf("%s (network: %q, hostSubnetBits: %d, serviceNetwork: %q, pluginName: %q)", n.Name, n.Network, n.HostSubnetLength, n.ServiceNetwork, n.PluginName) } @@ -36,7 +36,7 @@ type NetworkInfo struct { ServiceNetwork *net.IPNet } -func parseNetworkInfo(clusterNetwork string, serviceNetwork string) (*NetworkInfo, error) { +func ParseNetworkInfo(clusterNetwork string, serviceNetwork string) (*NetworkInfo, error) { cn, err := netutils.ParseCIDRMask(clusterNetwork) if err != nil { _, cn, err := net.ParseCIDR(clusterNetwork) @@ -60,7 +60,7 @@ func parseNetworkInfo(clusterNetwork string, serviceNetwork string) (*NetworkInf }, nil } -func (ni *NetworkInfo) validateNodeIP(nodeIP string) error { +func (ni *NetworkInfo) ValidateNodeIP(nodeIP string) error { if nodeIP == "" || nodeIP == "127.0.0.1" { return fmt.Errorf("invalid node IP %q", nodeIP) } @@ -82,7 +82,7 @@ func (ni *NetworkInfo) validateNodeIP(nodeIP string) error { return nil } -func (ni *NetworkInfo) checkHostNetworks(hostIPNets []*net.IPNet) error { +func (ni *NetworkInfo) CheckHostNetworks(hostIPNets []*net.IPNet) error { errList := []error{} for _, ipNet := range hostIPNets { if ipNet.Contains(ni.ClusterNetwork.IP) { @@ -101,7 +101,7 @@ func (ni *NetworkInfo) checkHostNetworks(hostIPNets []*net.IPNet) error { return kerrors.NewAggregate(errList) } -func (ni *NetworkInfo) checkClusterObjects(subnets []osapi.HostSubnet, pods []kapi.Pod, services []kapi.Service) error { +func (ni *NetworkInfo) CheckClusterObjects(subnets []osapi.HostSubnet, pods []kapi.Pod, services []kapi.Service) error { var errList []error for _, subnet := range subnets { @@ -142,13 +142,13 @@ func (ni *NetworkInfo) checkClusterObjects(subnets []osapi.HostSubnet, pods []ka return kerrors.NewAggregate(errList) } -func getNetworkInfo(osClient *osclient.Client) (*NetworkInfo, error) { +func GetNetworkInfo(osClient *osclient.Client) (*NetworkInfo, error) { cn, err := osClient.ClusterNetwork().Get(osapi.ClusterNetworkDefault, metav1.GetOptions{}) if err != nil { return nil, err } - return parseNetworkInfo(cn.Network, cn.ServiceNetwork) + return ParseNetworkInfo(cn.Network, cn.ServiceNetwork) } type ResourceName string diff --git a/pkg/sdn/plugin/common_test.go b/pkg/sdn/common/common_test.go similarity index 97% rename from pkg/sdn/plugin/common_test.go rename to pkg/sdn/common/common_test.go index df8089548eb0..2a6a5f1cfe02 100644 --- a/pkg/sdn/plugin/common_test.go +++ b/pkg/sdn/common/common_test.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "net" @@ -73,7 +73,7 @@ func Test_checkHostNetworks(t *testing.T) { } for _, test := range tests { - err := test.networkInfo.checkHostNetworks(hostIPNets) + err := test.networkInfo.CheckHostNetworks(hostIPNets) if test.expectError { if err == nil { t.Fatalf("unexpected lack of error checking %q", test.name) @@ -162,7 +162,7 @@ func Test_checkClusterObjects(t *testing.T) { } for _, test := range tests { - err := test.ni.checkClusterObjects(subnets, pods, services) + err := test.ni.CheckClusterObjects(subnets, pods, services) if err == nil { if len(test.errs) > 0 { t.Fatalf("test %q unexpectedly did not get an error", test.name) diff --git a/pkg/sdn/plugin/dns.go b/pkg/sdn/common/dns.go similarity index 99% rename from pkg/sdn/plugin/dns.go rename to pkg/sdn/common/dns.go index 5b5dc2bdf7c9..28170704cb99 100644 --- a/pkg/sdn/plugin/dns.go +++ b/pkg/sdn/common/dns.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "fmt" diff --git a/pkg/sdn/plugin/dns_test.go b/pkg/sdn/common/dns_test.go similarity index 99% rename from pkg/sdn/plugin/dns_test.go rename to pkg/sdn/common/dns_test.go index 4a5a162e3781..a5b5c23e44e7 100644 --- a/pkg/sdn/plugin/dns_test.go +++ b/pkg/sdn/common/dns_test.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "fmt" diff --git a/pkg/sdn/common/doc.go b/pkg/sdn/common/doc.go new file mode 100644 index 000000000000..fcd23e6e9be7 --- /dev/null +++ b/pkg/sdn/common/doc.go @@ -0,0 +1,2 @@ +// Package common contains the OpenShift SDN code that is shared between master, node, and proxy +package common diff --git a/pkg/sdn/plugin/egress_dns.go b/pkg/sdn/common/egress_dns.go similarity index 95% rename from pkg/sdn/plugin/egress_dns.go rename to pkg/sdn/common/egress_dns.go index 43dcd18d0357..569793cddc28 100644 --- a/pkg/sdn/plugin/egress_dns.go +++ b/pkg/sdn/common/egress_dns.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "net" @@ -30,7 +30,7 @@ type EgressDNS struct { added chan bool // Report changes when there are dns updates - updates chan EgressDNSUpdate + Updates chan EgressDNSUpdate } func NewEgressDNS() *EgressDNS { @@ -38,7 +38,7 @@ func NewEgressDNS() *EgressDNS { pdMap: map[ktypes.UID]*DNS{}, namespaces: map[ktypes.UID]string{}, added: make(chan bool), - updates: make(chan EgressDNSUpdate), + Updates: make(chan EgressDNSUpdate), } } @@ -100,7 +100,7 @@ func (e *EgressDNS) Sync() { } if changed { - e.updates <- EgressDNSUpdate{policyUID, policyNamespace} + e.Updates <- EgressDNSUpdate{policyUID, policyNamespace} } continue } diff --git a/pkg/sdn/plugin/eventqueue.go b/pkg/sdn/common/eventqueue.go similarity index 99% rename from pkg/sdn/plugin/eventqueue.go rename to pkg/sdn/common/eventqueue.go index a136624bfafd..b08e79184c93 100644 --- a/pkg/sdn/plugin/eventqueue.go +++ b/pkg/sdn/common/eventqueue.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "fmt" diff --git a/pkg/sdn/plugin/eventqueue_test.go b/pkg/sdn/common/eventqueue_test.go similarity index 99% rename from pkg/sdn/plugin/eventqueue_test.go rename to pkg/sdn/common/eventqueue_test.go index 32e9d0965a02..ed71aa433cef 100644 --- a/pkg/sdn/plugin/eventqueue_test.go +++ b/pkg/sdn/common/eventqueue_test.go @@ -1,4 +1,4 @@ -package plugin +package common import ( "fmt" diff --git a/pkg/sdn/plugin/egress_network_policy.go b/pkg/sdn/plugin/egress_network_policy.go index bb3437242c04..51587b711f1d 100644 --- a/pkg/sdn/plugin/egress_network_policy.go +++ b/pkg/sdn/plugin/egress_network_policy.go @@ -6,6 +6,7 @@ import ( "github.com/golang/glog" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilwait "k8s.io/apimachinery/pkg/util/wait" @@ -42,7 +43,7 @@ func (plugin *OsdnNode) SetupEgressNetworkPolicy() error { } func (plugin *OsdnNode) watchEgressNetworkPolicies() { - RunEventQueue(plugin.osClient, EgressNetworkPolicies, func(delta cache.Delta) error { + common.RunEventQueue(plugin.osClient, common.EgressNetworkPolicies, func(delta cache.Delta) error { policy := delta.Object.(*osapi.EgressNetworkPolicy) vnid, err := plugin.policy.GetVNID(policy.Namespace) @@ -99,7 +100,7 @@ func (plugin *OsdnNode) syncEgressDNSPolicyRules() { go utilwait.Forever(plugin.egressDNS.Sync, 0) for { - policyUpdates := <-plugin.egressDNS.updates + policyUpdates := <-plugin.egressDNS.Updates glog.V(5).Infof("Egress dns sync: updating policy: %v", policyUpdates.UID) vnid, err := plugin.policy.GetVNID(policyUpdates.Namespace) diff --git a/pkg/sdn/plugin/master.go b/pkg/sdn/plugin/master.go index 910ae876f8f3..9d758ce23b6e 100644 --- a/pkg/sdn/plugin/master.go +++ b/pkg/sdn/plugin/master.go @@ -12,6 +12,7 @@ import ( "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" osapivalidation "github.com/openshift/origin/pkg/sdn/apis/network/validation" + "github.com/openshift/origin/pkg/sdn/common" "github.com/openshift/origin/pkg/util/netutils" kapierrors "k8s.io/apimachinery/pkg/api/errors" @@ -26,7 +27,7 @@ import ( type OsdnMaster struct { kClient kclientset.Interface osClient *osclient.Client - networkInfo *NetworkInfo + networkInfo *common.NetworkInfo subnetAllocator *netutils.SubnetAllocator vnids *masterVNIDMap informers kinternalinformers.SharedInformerFactory @@ -50,7 +51,7 @@ func StartMaster(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclie } var err error - master.networkInfo, err = parseNetworkInfo(networkConfig.ClusterNetworkCIDR, networkConfig.ServiceNetworkCIDR) + master.networkInfo, err = common.ParseNetworkInfo(networkConfig.ClusterNetworkCIDR, networkConfig.ServiceNetworkCIDR) if err != nil { return err } @@ -85,7 +86,7 @@ func StartMaster(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclie if _, err = master.osClient.ClusterNetwork().Create(configCN); err != nil { return false, err } - log.Infof("Created ClusterNetwork %s", clusterNetworkToString(configCN)) + log.Infof("Created ClusterNetwork %s", common.ClusterNetworkToString(configCN)) if err = master.checkClusterNetworkAgainstClusterObjects(); err != nil { log.Errorf("WARNING: cluster contains objects incompatible with new ClusterNetwork: %v", err) @@ -101,9 +102,9 @@ func StartMaster(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclie if _, err = master.osClient.ClusterNetwork().Update(configCN); err != nil { return false, err } - log.Infof("Updated ClusterNetwork %s", clusterNetworkToString(configCN)) + log.Infof("Updated ClusterNetwork %s", common.ClusterNetworkToString(configCN)) } else { - log.V(5).Infof("No change to ClusterNetwork %s", clusterNetworkToString(configCN)) + log.V(5).Infof("No change to ClusterNetwork %s", common.ClusterNetworkToString(configCN)) } } @@ -141,7 +142,7 @@ func (master *OsdnMaster) checkClusterNetworkAgainstLocalNetworks() error { if err != nil { return err } - return master.networkInfo.checkHostNetworks(hostIPNets) + return master.networkInfo.CheckHostNetworks(hostIPNets) } func (master *OsdnMaster) checkClusterNetworkAgainstClusterObjects() error { @@ -158,7 +159,7 @@ func (master *OsdnMaster) checkClusterNetworkAgainstClusterObjects() error { services = serviceList.Items } - return master.networkInfo.checkClusterObjects(subnets, pods, services) + return master.networkInfo.CheckClusterObjects(subnets, pods, services) } func clusterNetworkChanged(obj *osapi.ClusterNetwork, old *osapi.ClusterNetwork) (bool, error) { diff --git a/pkg/sdn/plugin/master_test.go b/pkg/sdn/plugin/master_test.go index e5aba31a2d64..f2367db5d227 100644 --- a/pkg/sdn/plugin/master_test.go +++ b/pkg/sdn/plugin/master_test.go @@ -4,6 +4,7 @@ import ( "testing" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" ) func Test_clusterNetworkChanged(t *testing.T) { @@ -118,10 +119,10 @@ func Test_clusterNetworkChanged(t *testing.T) { changed, err := clusterNetworkChanged(&newCN, &origCN) if changed != expectChanged { - t.Fatalf("unexpected result (%t instead of %t) on %q: %s -> %s", changed, expectChanged, test.name, clusterNetworkToString(&origCN), clusterNetworkToString(&newCN)) + t.Fatalf("unexpected result (%t instead of %t) on %q: %s -> %s", changed, expectChanged, test.name, common.ClusterNetworkToString(&origCN), common.ClusterNetworkToString(&newCN)) } if (err != nil) != test.expectError { - t.Fatalf("unexpected error on %q: %s -> %s: %v", test.name, clusterNetworkToString(&origCN), clusterNetworkToString(&newCN), err) + t.Fatalf("unexpected error on %q: %s -> %s: %v", test.name, common.ClusterNetworkToString(&origCN), common.ClusterNetworkToString(&newCN), err) } } } diff --git a/pkg/sdn/plugin/networkpolicy.go b/pkg/sdn/plugin/networkpolicy.go index 5fed061776d8..0d724cd21417 100644 --- a/pkg/sdn/plugin/networkpolicy.go +++ b/pkg/sdn/plugin/networkpolicy.go @@ -24,6 +24,7 @@ import ( "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" ) type networkPolicyPlugin struct { @@ -392,7 +393,7 @@ func (np *networkPolicyPlugin) updateNetworkPolicy(npns *npNamespace, policy *ex } func (np *networkPolicyPlugin) watchNetworkPolicies() { - RunEventQueue(np.node.kClient.Extensions().RESTClient(), NetworkPolicies, func(delta cache.Delta) error { + common.RunEventQueue(np.node.kClient.Extensions().RESTClient(), common.NetworkPolicies, func(delta cache.Delta) error { policy := delta.Object.(*extensions.NetworkPolicy) glog.V(5).Infof("Watch %s event for NetworkPolicy %s/%s", delta.Type, policy.Namespace, policy.Name) @@ -429,8 +430,8 @@ func (np *networkPolicyPlugin) watchNetworkPolicies() { } func (np *networkPolicyPlugin) watchPods() { - RegisterSharedInformerEventHandlers(np.kubeInformers, - np.handleAddOrUpdatePod, np.handleDeletePod, Pods) + common.RegisterSharedInformerEventHandlers(np.kubeInformers, + np.handleAddOrUpdatePod, np.handleDeletePod, common.Pods) } func (np *networkPolicyPlugin) handleAddOrUpdatePod(obj, _ interface{}, eventType watch.EventType) { @@ -458,7 +459,7 @@ func (np *networkPolicyPlugin) handleAddOrUpdatePod(obj, _ interface{}, eventTyp defer np.lock.Unlock() np.pods[pod.UID] = *pod - np.refreshNetworkPolicies(Pods) + np.refreshNetworkPolicies(common.Pods) } func (np *networkPolicyPlugin) handleDeletePod(obj interface{}) { @@ -474,12 +475,12 @@ func (np *networkPolicyPlugin) handleDeletePod(obj interface{}) { defer np.lock.Unlock() delete(np.pods, pod.UID) - np.refreshNetworkPolicies(Pods) + np.refreshNetworkPolicies(common.Pods) } func (np *networkPolicyPlugin) watchNamespaces() { - RegisterSharedInformerEventHandlers(np.kubeInformers, - np.handleAddOrUpdateNamespace, np.handleDeleteNamespace, Namespaces) + common.RegisterSharedInformerEventHandlers(np.kubeInformers, + np.handleAddOrUpdateNamespace, np.handleDeleteNamespace, common.Namespaces) } func (np *networkPolicyPlugin) handleAddOrUpdateNamespace(obj, _ interface{}, eventType watch.EventType) { @@ -490,7 +491,7 @@ func (np *networkPolicyPlugin) handleAddOrUpdateNamespace(obj, _ interface{}, ev defer np.lock.Unlock() np.kNamespaces[ns.Name] = *ns - np.refreshNetworkPolicies(Namespaces) + np.refreshNetworkPolicies(common.Namespaces) } func (np *networkPolicyPlugin) handleDeleteNamespace(obj interface{}) { @@ -501,15 +502,15 @@ func (np *networkPolicyPlugin) handleDeleteNamespace(obj interface{}) { defer np.lock.Unlock() delete(np.kNamespaces, ns.Name) - np.refreshNetworkPolicies(Namespaces) + np.refreshNetworkPolicies(common.Namespaces) } -func (np *networkPolicyPlugin) refreshNetworkPolicies(watchResourceName ResourceName) { +func (np *networkPolicyPlugin) refreshNetworkPolicies(watchResourceName common.ResourceName) { for _, npns := range np.namespaces { changed := false for _, npp := range npns.policies { - if ((watchResourceName == Namespaces) && npp.watchesNamespaces) || - ((watchResourceName == Pods) && npp.watchesPods) { + if ((watchResourceName == common.Namespaces) && npp.watchesNamespaces) || + ((watchResourceName == common.Pods) && npp.watchesPods) { if np.updateNetworkPolicy(npns, &npp.policy) { changed = true break diff --git a/pkg/sdn/plugin/node.go b/pkg/sdn/plugin/node.go index 2e11efc437c8..a520fc7817cc 100644 --- a/pkg/sdn/plugin/node.go +++ b/pkg/sdn/plugin/node.go @@ -18,6 +18,7 @@ import ( osclient "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" "github.com/openshift/origin/pkg/util/ipcmd" "github.com/openshift/origin/pkg/util/netutils" "github.com/openshift/origin/pkg/util/ovs" @@ -83,7 +84,7 @@ type OsdnNode struct { kClient kclientset.Interface osClient *osclient.Client oc *ovsController - networkInfo *NetworkInfo + networkInfo *common.NetworkInfo podManager *podManager localSubnetCIDR string localIP string @@ -95,7 +96,7 @@ type OsdnNode struct { // Synchronizes operations on egressPolicies egressPoliciesLock sync.Mutex egressPolicies map[uint32][]osapi.EgressNetworkPolicy - egressDNS *EgressDNS + egressDNS *common.EgressDNS host knetwork.Host kubeletCniPlugin knetwork.NetworkPlugin @@ -183,7 +184,7 @@ func NewNodePlugin(c *OsdnNodeConfig) (sdn.NodeInterface, error) { iptablesSyncPeriod: c.IPTablesSyncPeriod, mtu: c.MTU, egressPolicies: make(map[uint32][]osapi.EgressNetworkPolicy), - egressDNS: NewEgressDNS(), + egressDNS: common.NewEgressDNS(), kubeInformers: c.KubeInformers, runtimeEndpoint: c.RuntimeEndpoint, @@ -290,7 +291,7 @@ func (node *OsdnNode) killUpdateFailedPods(pods []kapi.Pod) error { func (node *OsdnNode) Start() error { var err error - node.networkInfo, err = getNetworkInfo(node.osClient) + node.networkInfo, err = common.GetNetworkInfo(node.osClient) if err != nil { return fmt.Errorf("failed to get network information: %v", err) } @@ -299,7 +300,7 @@ func (node *OsdnNode) Start() error { if err != nil { return fmt.Errorf("failed to get host network information: %v", err) } - if err := node.networkInfo.checkHostNetworks(hostIPNets); err != nil { + if err := node.networkInfo.CheckHostNetworks(hostIPNets); err != nil { // checkHostNetworks() errors *should* be fatal, but we didn't used to check this, and we can't break (mostly-)working nodes on upgrade. log.Errorf("Local networks conflict with SDN; this will eventually cause problems: %v", err) } @@ -443,8 +444,8 @@ func isServiceChanged(oldsvc, newsvc *kapi.Service) bool { } func (node *OsdnNode) watchServices() { - RegisterSharedInformerEventHandlers(node.kubeInformers, - node.handleAddOrUpdateService, node.handleDeleteService, Services) + common.RegisterSharedInformerEventHandlers(node.kubeInformers, + node.handleAddOrUpdateService, node.handleDeleteService, common.Services) } func (node *OsdnNode) handleAddOrUpdateService(obj, oldObj interface{}, eventType watch.EventType) { diff --git a/pkg/sdn/plugin/ovscontroller.go b/pkg/sdn/plugin/ovscontroller.go index 2cc8b315fa94..eea6bdbfaf8c 100644 --- a/pkg/sdn/plugin/ovscontroller.go +++ b/pkg/sdn/plugin/ovscontroller.go @@ -11,6 +11,7 @@ import ( "github.com/golang/glog" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" "github.com/openshift/origin/pkg/util/ovs" "k8s.io/apimachinery/pkg/util/sets" @@ -397,7 +398,7 @@ func policyNames(policies []osapi.EgressNetworkPolicy) string { return strings.Join(names, ", ") } -func (oc *ovsController) UpdateEgressNetworkPolicyRules(policies []osapi.EgressNetworkPolicy, vnid uint32, namespaces []string, egressDNS *EgressDNS) error { +func (oc *ovsController) UpdateEgressNetworkPolicyRules(policies []osapi.EgressNetworkPolicy, vnid uint32, namespaces []string, egressDNS *common.EgressDNS) error { otx := oc.ovs.NewTransaction() var inputErr error @@ -461,7 +462,7 @@ func (oc *ovsController) UpdateEgressNetworkPolicyRules(policies []osapi.EgressN } if dnsFound { - if err := CheckDNSResolver(); err != nil { + if err := common.CheckDNSResolver(); err != nil { inputErr = fmt.Errorf("DNS resolver failed: %v, dropping all traffic for namespace: %q", err, namespaces[0]) otx.DeleteFlows("table=100, reg0=%d", vnid) otx.AddFlow("table=100, reg0=%d, priority=1, actions=drop", vnid) diff --git a/pkg/sdn/plugin/proxy.go b/pkg/sdn/plugin/proxy.go index 659e18230ffc..95e2993e9cb9 100644 --- a/pkg/sdn/plugin/proxy.go +++ b/pkg/sdn/plugin/proxy.go @@ -10,6 +10,7 @@ import ( osclient "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ktypes "k8s.io/apimachinery/pkg/types" @@ -46,8 +47,8 @@ type proxyEndpoints struct { type OsdnProxy struct { kClient kclientset.Interface osClient *osclient.Client - networkInfo *NetworkInfo - egressDNS *EgressDNS + networkInfo *common.NetworkInfo + egressDNS *common.EgressDNS baseEndpointsHandler pconfig.EndpointsHandler lock sync.Mutex @@ -68,7 +69,7 @@ func NewProxyPlugin(pluginName string, osClient *osclient.Client, kClient kclien kClient: kClient, osClient: osClient, ids: make(map[string]uint32), - egressDNS: NewEgressDNS(), + egressDNS: common.NewEgressDNS(), firewall: make(map[string]*proxyFirewallItem), allEndpoints: make(map[ktypes.UID]*proxyEndpoints), }, nil @@ -78,7 +79,7 @@ func (proxy *OsdnProxy) Start(baseHandler pconfig.EndpointsHandler) error { glog.Infof("Starting multitenant SDN proxy endpoint filter") var err error - proxy.networkInfo, err = getNetworkInfo(proxy.osClient) + proxy.networkInfo, err = common.GetNetworkInfo(proxy.osClient) if err != nil { return fmt.Errorf("could not get network info: %s", err) } @@ -104,7 +105,7 @@ func (proxy *OsdnProxy) Start(baseHandler pconfig.EndpointsHandler) error { } func (proxy *OsdnProxy) watchEgressNetworkPolicies() { - RunEventQueue(proxy.osClient, EgressNetworkPolicies, func(delta cache.Delta) error { + common.RunEventQueue(proxy.osClient, common.EgressNetworkPolicies, func(delta cache.Delta) error { policy := delta.Object.(*osapi.EgressNetworkPolicy) proxy.egressDNS.Delete(*policy) @@ -125,7 +126,7 @@ func (proxy *OsdnProxy) watchEgressNetworkPolicies() { // TODO: Abstract common code shared between proxy and node func (proxy *OsdnProxy) watchNetNamespaces() { - RunEventQueue(proxy.osClient, NetNamespaces, func(delta cache.Delta) error { + common.RunEventQueue(proxy.osClient, common.NetNamespaces, func(delta cache.Delta) error { netns := delta.Object.(*osapi.NetNamespace) name := netns.ObjectMeta.Name @@ -207,7 +208,7 @@ func (proxy *OsdnProxy) updateEgressNetworkPolicy(policy osapi.EgressNetworkPoli // Set active policy for the namespace if ref, ok := proxy.firewall[ns]; ok { if dnsFound { - if err := CheckDNSResolver(); err != nil { + if err := common.CheckDNSResolver(); err != nil { ref.activePolicy = nil glog.Errorf("DNS resolver failed: %v, dropping all firewall rules for namespace: %q", err, ns) return @@ -339,7 +340,7 @@ func (proxy *OsdnProxy) syncEgressDNSProxyFirewall() { go utilwait.Forever(proxy.egressDNS.Sync, 0) for { - policyUpdates := <-proxy.egressDNS.updates + policyUpdates := <-proxy.egressDNS.Updates glog.V(5).Infof("Egress dns sync: update proxy firewall for policy: %v", policyUpdates.UID) policy, ok := getPolicy(policyUpdates.UID, policies) diff --git a/pkg/sdn/plugin/sdn_controller.go b/pkg/sdn/plugin/sdn_controller.go index 7f6a318e47ab..053fee569a71 100644 --- a/pkg/sdn/plugin/sdn_controller.go +++ b/pkg/sdn/plugin/sdn_controller.go @@ -9,6 +9,7 @@ import ( "github.com/golang/glog" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" "github.com/openshift/origin/pkg/util/ipcmd" "github.com/openshift/origin/pkg/util/netutils" @@ -51,7 +52,7 @@ func (plugin *OsdnNode) getLocalSubnet() (string, error) { return "", fmt.Errorf("failed to get subnet for this host: %s, error: %v", plugin.hostName, err) } - if err = plugin.networkInfo.validateNodeIP(subnet.HostIP); err != nil { + if err = plugin.networkInfo.ValidateNodeIP(subnet.HostIP); err != nil { return "", fmt.Errorf("failed to validate own HostSubnet: %v", err) } @@ -201,14 +202,14 @@ func (plugin *OsdnNode) updateEgressNetworkPolicyRules(vnid uint32) { } func (plugin *OsdnNode) AddHostSubnetRules(subnet *osapi.HostSubnet) { - glog.Infof("AddHostSubnetRules for %s", hostSubnetToString(subnet)) + glog.Infof("AddHostSubnetRules for %s", common.HostSubnetToString(subnet)) if err := plugin.oc.AddHostSubnetRules(subnet); err != nil { glog.Errorf("Error adding OVS flows for subnet %q: %v", subnet.Subnet, err) } } func (plugin *OsdnNode) DeleteHostSubnetRules(subnet *osapi.HostSubnet) { - glog.Infof("DeleteHostSubnetRules for %s", hostSubnetToString(subnet)) + glog.Infof("DeleteHostSubnetRules for %s", common.HostSubnetToString(subnet)) if err := plugin.oc.DeleteHostSubnetRules(subnet); err != nil { glog.Errorf("Error deleting OVS flows for subnet %q: %v", subnet.Subnet, err) } diff --git a/pkg/sdn/plugin/subnets.go b/pkg/sdn/plugin/subnets.go index 0c867b2dc1c0..3a34b7c90e77 100644 --- a/pkg/sdn/plugin/subnets.go +++ b/pkg/sdn/plugin/subnets.go @@ -17,6 +17,7 @@ import ( "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" "github.com/openshift/origin/pkg/util/netutils" ) @@ -29,11 +30,11 @@ func (master *OsdnMaster) SubnetStartMaster(clusterNetwork *net.IPNet, hostSubne } for _, sub := range subnets.Items { subrange = append(subrange, sub.Subnet) - if err = master.networkInfo.validateNodeIP(sub.HostIP); err != nil { + if err = master.networkInfo.ValidateNodeIP(sub.HostIP); err != nil { // Don't error out; just warn so the error can be corrected with 'oc' - log.Errorf("Failed to validate HostSubnet %s: %v", hostSubnetToString(&sub), err) + log.Errorf("Failed to validate HostSubnet %s: %v", common.HostSubnetToString(&sub), err) } else { - log.Infof("Found existing HostSubnet %s", hostSubnetToString(&sub)) + log.Infof("Found existing HostSubnet %s", common.HostSubnetToString(&sub)) } } @@ -52,7 +53,7 @@ func (master *OsdnMaster) SubnetStartMaster(clusterNetwork *net.IPNet, hostSubne // Returns the IP address used for hostsubnet (either the preferred or one from the otherValidAddresses) and any error func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations map[string]string, otherValidAddresses []kapi.NodeAddress) (string, error) { // Validate node IP before proceeding - if err := master.networkInfo.validateNodeIP(nodeIP); err != nil { + if err := master.networkInfo.ValidateNodeIP(nodeIP); err != nil { return "", err } @@ -70,7 +71,7 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations if err != nil { return "", fmt.Errorf("error updating subnet %s for node %s: %v", sub.Subnet, nodeName, err) } - log.Infof("Updated HostSubnet %s", hostSubnetToString(sub)) + log.Infof("Updated HostSubnet %s", common.HostSubnetToString(sub)) return nodeIP, nil } } @@ -93,7 +94,7 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations master.subnetAllocator.ReleaseNetwork(sn) return "", fmt.Errorf("error creating subnet %s for node %s: %v", sn.String(), nodeName, err) } - log.Infof("Created HostSubnet %s", hostSubnetToString(sub)) + log.Infof("Created HostSubnet %s", common.HostSubnetToString(sub)) return nodeIP, nil } @@ -107,7 +108,7 @@ func (master *OsdnMaster) deleteNode(nodeName string) error { return fmt.Errorf("error deleting subnet %v for node %q: %v", sub, nodeName, err) } - log.Infof("Deleted HostSubnet %s", hostSubnetToString(sub)) + log.Infof("Deleted HostSubnet %s", common.HostSubnetToString(sub)) return nil } @@ -184,8 +185,8 @@ func GetNodeCondition(status *kapi.NodeStatus, conditionType kapi.NodeConditionT } func (master *OsdnMaster) watchNodes() { - RegisterSharedInformerEventHandlers(master.informers, - master.handleAddOrUpdateNode, master.handleDeleteNode, Nodes) + common.RegisterSharedInformerEventHandlers(master.informers, + master.handleAddOrUpdateNode, master.handleDeleteNode, common.Nodes) } func (master *OsdnMaster) handleAddOrUpdateNode(obj, _ interface{}, eventType watch.EventType) { @@ -230,7 +231,7 @@ func (node *OsdnNode) SubnetStartNode() error { // Only run on the master // Watch for all hostsubnet events and if one is found with the right annotation, use the SubnetAllocator to dole a real subnet func (master *OsdnMaster) watchSubnets() { - RunEventQueue(master.osClient, HostSubnets, func(delta cache.Delta) error { + common.RunEventQueue(master.osClient, common.HostSubnets, func(delta cache.Delta) error { hs := delta.Object.(*osapi.HostSubnet) name := hs.ObjectMeta.Name hostIP := hs.HostIP @@ -297,7 +298,7 @@ func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) { // Only run on the nodes func (node *OsdnNode) watchSubnets() { subnets := make(hostSubnetMap) - RunEventQueue(node.osClient, HostSubnets, func(delta cache.Delta) error { + common.RunEventQueue(node.osClient, common.HostSubnets, func(delta cache.Delta) error { hs := delta.Object.(*osapi.HostSubnet) if hs.HostIP == node.localIP { return nil @@ -315,7 +316,7 @@ func (node *OsdnNode) watchSubnets() { node.DeleteHostSubnetRules(oldSubnet) } } - if err := node.networkInfo.validateNodeIP(hs.HostIP); err != nil { + if err := node.networkInfo.ValidateNodeIP(hs.HostIP); err != nil { log.Warningf("Ignoring invalid subnet for node %s: %v", hs.HostIP, err) break } diff --git a/pkg/sdn/plugin/vnids_master.go b/pkg/sdn/plugin/vnids_master.go index 09910b8efb42..b060cd73b0a1 100644 --- a/pkg/sdn/plugin/vnids_master.go +++ b/pkg/sdn/plugin/vnids_master.go @@ -16,6 +16,7 @@ import ( osclient "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" pnetid "github.com/openshift/origin/pkg/sdn/plugin/netid" ) @@ -282,8 +283,8 @@ func (master *OsdnMaster) VnidStartMaster() error { } func (master *OsdnMaster) watchNamespaces() { - RegisterSharedInformerEventHandlers(master.informers, - master.handleAddOrUpdateNamespace, master.handleDeleteNamespace, Namespaces) + common.RegisterSharedInformerEventHandlers(master.informers, + master.handleAddOrUpdateNamespace, master.handleDeleteNamespace, common.Namespaces) } func (master *OsdnMaster) handleAddOrUpdateNamespace(obj, _ interface{}, eventType watch.EventType) { @@ -303,7 +304,7 @@ func (master *OsdnMaster) handleDeleteNamespace(obj interface{}) { } func (master *OsdnMaster) watchNetNamespaces() { - RunEventQueue(master.osClient, NetNamespaces, func(delta cache.Delta) error { + common.RunEventQueue(master.osClient, common.NetNamespaces, func(delta cache.Delta) error { netns := delta.Object.(*osapi.NetNamespace) name := netns.ObjectMeta.Name diff --git a/pkg/sdn/plugin/vnids_node.go b/pkg/sdn/plugin/vnids_node.go index d89d9694f7a5..55a34268a340 100644 --- a/pkg/sdn/plugin/vnids_node.go +++ b/pkg/sdn/plugin/vnids_node.go @@ -14,6 +14,7 @@ import ( osclient "github.com/openshift/origin/pkg/client" osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" ) type nodeVNIDMap struct { @@ -175,7 +176,7 @@ func (vmap *nodeVNIDMap) Start() error { } func (vmap *nodeVNIDMap) watchNetNamespaces() { - RunEventQueue(vmap.osClient, NetNamespaces, func(delta cache.Delta) error { + common.RunEventQueue(vmap.osClient, common.NetNamespaces, func(delta cache.Delta) error { netns := delta.Object.(*osapi.NetNamespace) log.V(5).Infof("Watch %s event for NetNamespace %q", delta.Type, netns.ObjectMeta.Name) From 0320dcce47d3db30e67af1865bb78a518263f043 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 10 Jul 2017 09:44:30 -0400 Subject: [PATCH 2/3] Split master/node code from subnets.go into separate files --- .../plugin/{subnets.go => subnets_master.go} | 58 ---------------- pkg/sdn/plugin/subnets_node.go | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 58 deletions(-) rename pkg/sdn/plugin/{subnets.go => subnets_master.go} (85%) create mode 100644 pkg/sdn/plugin/subnets_node.go diff --git a/pkg/sdn/plugin/subnets.go b/pkg/sdn/plugin/subnets_master.go similarity index 85% rename from pkg/sdn/plugin/subnets.go rename to pkg/sdn/plugin/subnets_master.go index 3a34b7c90e77..c7c0e0744fc5 100644 --- a/pkg/sdn/plugin/subnets.go +++ b/pkg/sdn/plugin/subnets_master.go @@ -223,12 +223,6 @@ func (master *OsdnMaster) handleDeleteNode(obj interface{}) { } } -func (node *OsdnNode) SubnetStartNode() error { - go utilwait.Forever(node.watchSubnets, 0) - return nil -} - -// Only run on the master // Watch for all hostsubnet events and if one is found with the right annotation, use the SubnetAllocator to dole a real subnet func (master *OsdnMaster) watchSubnets() { common.RunEventQueue(master.osClient, common.HostSubnets, func(delta cache.Delta) error { @@ -280,55 +274,3 @@ func (master *OsdnMaster) watchSubnets() { return nil }) } - -type hostSubnetMap map[string]*osapi.HostSubnet - -func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) { - remoteIPs := make([]string, 0, len(subnets)-1) - for _, subnet := range subnets { - if subnet.HostIP != plugin.localIP { - remoteIPs = append(remoteIPs, subnet.HostIP) - } - } - if err := plugin.oc.UpdateVXLANMulticastFlows(remoteIPs); err != nil { - log.Errorf("Error updating OVS VXLAN multicast flows: %v", err) - } -} - -// Only run on the nodes -func (node *OsdnNode) watchSubnets() { - subnets := make(hostSubnetMap) - common.RunEventQueue(node.osClient, common.HostSubnets, func(delta cache.Delta) error { - hs := delta.Object.(*osapi.HostSubnet) - if hs.HostIP == node.localIP { - return nil - } - - log.V(5).Infof("Watch %s event for HostSubnet %q", delta.Type, hs.ObjectMeta.Name) - switch delta.Type { - case cache.Sync, cache.Added, cache.Updated: - oldSubnet, exists := subnets[string(hs.UID)] - if exists { - if oldSubnet.HostIP == hs.HostIP { - break - } else { - // Delete old subnet rules - node.DeleteHostSubnetRules(oldSubnet) - } - } - if err := node.networkInfo.ValidateNodeIP(hs.HostIP); err != nil { - log.Warningf("Ignoring invalid subnet for node %s: %v", hs.HostIP, err) - break - } - - node.AddHostSubnetRules(hs) - subnets[string(hs.UID)] = hs - case cache.Deleted: - delete(subnets, string(hs.UID)) - node.DeleteHostSubnetRules(hs) - } - // Update multicast rules after all other changes have been processed - node.updateVXLANMulticastRules(subnets) - return nil - }) -} diff --git a/pkg/sdn/plugin/subnets_node.go b/pkg/sdn/plugin/subnets_node.go new file mode 100644 index 000000000000..67f58fe8810f --- /dev/null +++ b/pkg/sdn/plugin/subnets_node.go @@ -0,0 +1,67 @@ +package plugin + +import ( + log "github.com/golang/glog" + + utilwait "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/tools/cache" + + osapi "github.com/openshift/origin/pkg/sdn/apis/network" + "github.com/openshift/origin/pkg/sdn/common" +) + +func (node *OsdnNode) SubnetStartNode() error { + go utilwait.Forever(node.watchSubnets, 0) + return nil +} + +type hostSubnetMap map[string]*osapi.HostSubnet + +func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) { + remoteIPs := make([]string, 0, len(subnets)-1) + for _, subnet := range subnets { + if subnet.HostIP != plugin.localIP { + remoteIPs = append(remoteIPs, subnet.HostIP) + } + } + if err := plugin.oc.UpdateVXLANMulticastFlows(remoteIPs); err != nil { + log.Errorf("Error updating OVS VXLAN multicast flows: %v", err) + } +} + +func (node *OsdnNode) watchSubnets() { + subnets := make(hostSubnetMap) + common.RunEventQueue(node.osClient, common.HostSubnets, func(delta cache.Delta) error { + hs := delta.Object.(*osapi.HostSubnet) + if hs.HostIP == node.localIP { + return nil + } + + log.V(5).Infof("Watch %s event for HostSubnet %q", delta.Type, hs.ObjectMeta.Name) + switch delta.Type { + case cache.Sync, cache.Added, cache.Updated: + oldSubnet, exists := subnets[string(hs.UID)] + if exists { + if oldSubnet.HostIP == hs.HostIP { + break + } else { + // Delete old subnet rules + node.DeleteHostSubnetRules(oldSubnet) + } + } + if err := node.networkInfo.ValidateNodeIP(hs.HostIP); err != nil { + log.Warningf("Ignoring invalid subnet for node %s: %v", hs.HostIP, err) + break + } + + node.AddHostSubnetRules(hs) + subnets[string(hs.UID)] = hs + case cache.Deleted: + delete(subnets, string(hs.UID)) + node.DeleteHostSubnetRules(hs) + } + // Update multicast rules after all other changes have been processed + node.updateVXLANMulticastRules(subnets) + return nil + }) +} From 4570e2791b0d175981deb68572b0a337f4cbacb5 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 17 Oct 2016 15:44:03 -0400 Subject: [PATCH 3/3] Split up SDN master/node/proxy/CNI code --- hack/lib/build/constants.sh | 2 +- pkg/cmd/server/kubernetes/node/node.go | 8 ++++---- pkg/cmd/server/kubernetes/node/node_config.go | 12 ++++++------ pkg/cmd/server/kubernetes/node/sdn_linux.go | 7 ++++--- pkg/cmd/server/origin/controller/network_linux.go | 4 ++-- pkg/cmd/server/start/start_node.go | 2 +- pkg/sdn/master/doc.go | 2 ++ pkg/sdn/{plugin => master}/master.go | 7 ++++--- pkg/sdn/{plugin => master}/master_test.go | 2 +- pkg/sdn/{plugin => master}/netid/allocator.go | 0 pkg/sdn/{plugin => master}/netid/allocator_test.go | 0 pkg/sdn/{plugin => master}/netid/netid.go | 0 pkg/sdn/{plugin => master}/netid/netid_test.go | 0 .../{plugin/subnets_master.go => master/subnets.go} | 2 +- pkg/sdn/{plugin/vnids_master.go => master/vnids.go} | 4 ++-- .../vnids_master_test.go => master/vnids_test.go} | 2 +- pkg/sdn/{plugin => node}/cniserver/cniserver.go | 0 pkg/sdn/{plugin => node}/cniserver/cniserver_test.go | 0 pkg/sdn/node/doc.go | 2 ++ pkg/sdn/{plugin => node}/egress_network_policy.go | 2 +- .../{plugin/node_iptables.go => node/iptables.go} | 2 +- pkg/sdn/{plugin => node}/multitenant.go | 2 +- pkg/sdn/{plugin => node}/networkpolicy.go | 2 +- pkg/sdn/{plugin => node}/node.go | 6 +++--- pkg/sdn/{plugin => node}/ovscontroller.go | 2 +- pkg/sdn/{plugin => node}/ovscontroller_test.go | 2 +- pkg/sdn/{plugin => node}/pod.go | 4 ++-- pkg/sdn/{plugin => node}/pod_test.go | 4 ++-- pkg/sdn/{plugin => node}/runtime.go | 2 +- pkg/sdn/{plugin => node}/sdn_controller.go | 2 +- pkg/sdn/{plugin => node}/singletenant.go | 2 +- pkg/sdn/{plugin/subnets_node.go => node/subnets.go} | 2 +- pkg/sdn/{plugin/vnids_node.go => node/vnids.go} | 2 +- .../vnids_node_test.go => node/vnids_test.go} | 2 +- pkg/sdn/proxy/doc.go | 2 ++ pkg/sdn/{plugin => proxy}/proxy.go | 4 ++-- pkg/sdn/{plugin => }/sdn-cni-plugin/doc.go | 0 pkg/sdn/{plugin => }/sdn-cni-plugin/openshift-sdn.go | 2 +- .../sdn-cni-plugin/sdn_cni_plugin_test.go | 2 +- 39 files changed, 56 insertions(+), 48 deletions(-) mode change 100644 => 100755 hack/lib/build/constants.sh create mode 100644 pkg/sdn/master/doc.go rename pkg/sdn/{plugin => master}/master.go (95%) rename pkg/sdn/{plugin => master}/master_test.go (99%) rename pkg/sdn/{plugin => master}/netid/allocator.go (100%) rename pkg/sdn/{plugin => master}/netid/allocator_test.go (100%) rename pkg/sdn/{plugin => master}/netid/netid.go (100%) rename pkg/sdn/{plugin => master}/netid/netid_test.go (100%) rename pkg/sdn/{plugin/subnets_master.go => master/subnets.go} (99%) rename pkg/sdn/{plugin/vnids_master.go => master/vnids.go} (99%) rename pkg/sdn/{plugin/vnids_master_test.go => master/vnids_test.go} (99%) rename pkg/sdn/{plugin => node}/cniserver/cniserver.go (100%) rename pkg/sdn/{plugin => node}/cniserver/cniserver_test.go (100%) create mode 100644 pkg/sdn/node/doc.go rename pkg/sdn/{plugin => node}/egress_network_policy.go (99%) rename pkg/sdn/{plugin/node_iptables.go => node/iptables.go} (99%) rename pkg/sdn/{plugin => node}/multitenant.go (99%) rename pkg/sdn/{plugin => node}/networkpolicy.go (99%) rename pkg/sdn/{plugin => node}/node.go (99%) rename pkg/sdn/{plugin => node}/ovscontroller.go (99%) rename pkg/sdn/{plugin => node}/ovscontroller_test.go (99%) rename pkg/sdn/{plugin => node}/pod.go (99%) rename pkg/sdn/{plugin => node}/pod_test.go (99%) rename pkg/sdn/{plugin => node}/runtime.go (99%) rename pkg/sdn/{plugin => node}/sdn_controller.go (99%) rename pkg/sdn/{plugin => node}/singletenant.go (98%) rename pkg/sdn/{plugin/subnets_node.go => node/subnets.go} (99%) rename pkg/sdn/{plugin/vnids_node.go => node/vnids.go} (99%) rename pkg/sdn/{plugin/vnids_node_test.go => node/vnids_test.go} (99%) create mode 100644 pkg/sdn/proxy/doc.go rename pkg/sdn/{plugin => proxy}/proxy.go (98%) rename pkg/sdn/{plugin => }/sdn-cni-plugin/doc.go (100%) rename pkg/sdn/{plugin => }/sdn-cni-plugin/openshift-sdn.go (98%) rename pkg/sdn/{plugin => }/sdn-cni-plugin/sdn_cni_plugin_test.go (98%) diff --git a/hack/lib/build/constants.sh b/hack/lib/build/constants.sh old mode 100644 new mode 100755 index 0b6309c1999a..66d6982e6d74 --- a/hack/lib/build/constants.sh +++ b/hack/lib/build/constants.sh @@ -19,7 +19,7 @@ readonly OS_OUTPUT_PKGDIR="${OS_OUTPUT}/pkgdir" readonly OS_GO_PACKAGE=github.com/openshift/origin readonly OS_SDN_COMPILE_TARGETS_LINUX=( - pkg/sdn/plugin/sdn-cni-plugin + pkg/sdn/sdn-cni-plugin vendor/github.com/containernetworking/cni/plugins/ipam/host-local vendor/github.com/containernetworking/cni/plugins/main/loopback ) diff --git a/pkg/cmd/server/kubernetes/node/node.go b/pkg/cmd/server/kubernetes/node/node.go index c4c41c1d5d38..e9343859aa09 100644 --- a/pkg/cmd/server/kubernetes/node/node.go +++ b/pkg/cmd/server/kubernetes/node/node.go @@ -301,12 +301,12 @@ func SetFakeContainerManagerInterfaceForIntegrationTest() { defaultContainerManagerInterface = cm.NewStubContainerManager() } -// RunPlugin starts the local SDN plugin, if enabled in configuration. -func (c *NodeConfig) RunPlugin() { - if c.SDNPlugin == nil { +// RunSDN starts the SDN, if the OpenShift SDN network plugin is enabled in configuration. +func (c *NodeConfig) RunSDN() { + if c.SDNNode == nil { return } - if err := c.SDNPlugin.Start(); err != nil { + if err := c.SDNNode.Start(); err != nil { glog.Fatalf("error: SDN node startup failed: %v", err) } } diff --git a/pkg/cmd/server/kubernetes/node/node_config.go b/pkg/cmd/server/kubernetes/node/node_config.go index ce36246ee9b3..bf5a709eaf39 100644 --- a/pkg/cmd/server/kubernetes/node/node_config.go +++ b/pkg/cmd/server/kubernetes/node/node_config.go @@ -79,8 +79,8 @@ type NodeConfig struct { // DNSConfig controls the DNS configuration. DNSServer *dns.Server - // SDNPlugin is an optional SDN plugin - SDNPlugin sdn.NodeInterface + // SDNNode is an optional SDN node interface + SDNNode sdn.NodeInterface // SDNProxy is an optional service endpoints filterer SDNProxy sdn.ProxyInterface } @@ -234,10 +234,10 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable internalKubeInformers := kinternalinformers.NewSharedInformerFactory(kubeClient, proxyconfig.ConfigSyncPeriod.Duration) // Initialize SDN before building kubelet config so it can modify option - var sdnPlugin sdn.NodeInterface + var sdnNode sdn.NodeInterface var sdnProxy sdn.ProxyInterface if sdn.IsOpenShiftNetworkPlugin(options.NetworkConfig.NetworkPluginName) { - sdnPlugin, sdnProxy, err = NewSDNInterfaces(options, originClient, kubeClient, internalKubeInformers, proxyconfig) + sdnNode, sdnProxy, err = NewSDNInterfaces(options, originClient, kubeClient, internalKubeInformers, proxyconfig) if err != nil { return nil, fmt.Errorf("SDN initialization failed: %v", err) } @@ -312,8 +312,8 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enable ProxyConfig: proxyconfig, EnableUnidling: options.EnableUnidling, - SDNPlugin: sdnPlugin, - SDNProxy: sdnProxy, + SDNNode: sdnNode, + SDNProxy: sdnProxy, } if enableDNS { diff --git a/pkg/cmd/server/kubernetes/node/sdn_linux.go b/pkg/cmd/server/kubernetes/node/sdn_linux.go index d2abd5cc75b5..66d7393936fc 100644 --- a/pkg/cmd/server/kubernetes/node/sdn_linux.go +++ b/pkg/cmd/server/kubernetes/node/sdn_linux.go @@ -8,11 +8,12 @@ import ( osclient "github.com/openshift/origin/pkg/client" configapi "github.com/openshift/origin/pkg/cmd/server/api" "github.com/openshift/origin/pkg/sdn" - sdnplugin "github.com/openshift/origin/pkg/sdn/plugin" + sdnnode "github.com/openshift/origin/pkg/sdn/node" + sdnproxy "github.com/openshift/origin/pkg/sdn/proxy" ) func NewSDNInterfaces(options configapi.NodeConfig, originClient *osclient.Client, kubeClient kclientset.Interface, internalKubeInformers kinternalinformers.SharedInformerFactory, proxyconfig *componentconfig.KubeProxyConfiguration) (sdn.NodeInterface, sdn.ProxyInterface, error) { - node, err := sdnplugin.NewNodePlugin(&sdnplugin.OsdnNodeConfig{ + node, err := sdnnode.New(&sdnnode.OsdnNodeConfig{ PluginName: options.NetworkConfig.NetworkPluginName, Hostname: options.NodeName, SelfIP: options.NodeIP, @@ -28,7 +29,7 @@ func NewSDNInterfaces(options configapi.NodeConfig, originClient *osclient.Clien return nil, nil, err } - proxy, err := sdnplugin.NewProxyPlugin(options.NetworkConfig.NetworkPluginName, originClient, kubeClient) + proxy, err := sdnproxy.New(options.NetworkConfig.NetworkPluginName, originClient, kubeClient) if err != nil { return nil, nil, err } diff --git a/pkg/cmd/server/origin/controller/network_linux.go b/pkg/cmd/server/origin/controller/network_linux.go index f6f93dc20608..beee71203b5d 100644 --- a/pkg/cmd/server/origin/controller/network_linux.go +++ b/pkg/cmd/server/origin/controller/network_linux.go @@ -8,7 +8,7 @@ import ( osclient "github.com/openshift/origin/pkg/client" configapi "github.com/openshift/origin/pkg/cmd/server/api" "github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" - sdnplugin "github.com/openshift/origin/pkg/sdn/plugin" + sdnmaster "github.com/openshift/origin/pkg/sdn/master" ) type SDNControllerConfig struct { @@ -29,7 +29,7 @@ func (c *SDNControllerConfig) RunController(ctx ControllerContext) (bool, error) if err != nil { return false, err } - err = sdnplugin.StartMaster( + err = sdnmaster.Start( c.NetworkConfig, osClient, kClient, diff --git a/pkg/cmd/server/start/start_node.go b/pkg/cmd/server/start/start_node.go index 1c98d6acfa41..fe95a7135033 100644 --- a/pkg/cmd/server/start/start_node.go +++ b/pkg/cmd/server/start/start_node.go @@ -365,7 +365,7 @@ func StartNode(nodeConfig configapi.NodeConfig, components *utilflags.ComponentF config.RunKubelet() } if components.Enabled(ComponentPlugins) { - config.RunPlugin() + config.RunSDN() } if components.Enabled(ComponentProxy) { config.RunProxy() diff --git a/pkg/sdn/master/doc.go b/pkg/sdn/master/doc.go new file mode 100644 index 000000000000..44eb3b9fcb94 --- /dev/null +++ b/pkg/sdn/master/doc.go @@ -0,0 +1,2 @@ +// Package master contains the OpenShift SDN code that runs on the master +package master diff --git a/pkg/sdn/plugin/master.go b/pkg/sdn/master/master.go similarity index 95% rename from pkg/sdn/plugin/master.go rename to pkg/sdn/master/master.go index 9d758ce23b6e..0932da3a4292 100644 --- a/pkg/sdn/plugin/master.go +++ b/pkg/sdn/master/master.go @@ -1,4 +1,4 @@ -package plugin +package master import ( "fmt" @@ -13,6 +13,7 @@ import ( osapi "github.com/openshift/origin/pkg/sdn/apis/network" osapivalidation "github.com/openshift/origin/pkg/sdn/apis/network/validation" "github.com/openshift/origin/pkg/sdn/common" + "github.com/openshift/origin/pkg/sdn/node" "github.com/openshift/origin/pkg/util/netutils" kapierrors "k8s.io/apimachinery/pkg/api/errors" @@ -36,7 +37,7 @@ type OsdnMaster struct { hostSubnetNodeIPs map[ktypes.UID]string } -func StartMaster(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclient.Client, kClient kclientset.Interface, informers kinternalinformers.SharedInformerFactory) error { +func Start(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclient.Client, kClient kclientset.Interface, informers kinternalinformers.SharedInformerFactory) error { if !sdn.IsOpenShiftNetworkPlugin(networkConfig.NetworkPluginName) { return nil } @@ -138,7 +139,7 @@ func StartMaster(networkConfig osconfigapi.MasterNetworkConfig, osClient *osclie } func (master *OsdnMaster) checkClusterNetworkAgainstLocalNetworks() error { - hostIPNets, _, err := netutils.GetHostIPNetworks([]string{Tun0}) + hostIPNets, _, err := netutils.GetHostIPNetworks([]string{node.Tun0}) if err != nil { return err } diff --git a/pkg/sdn/plugin/master_test.go b/pkg/sdn/master/master_test.go similarity index 99% rename from pkg/sdn/plugin/master_test.go rename to pkg/sdn/master/master_test.go index f2367db5d227..4f59f08686d1 100644 --- a/pkg/sdn/plugin/master_test.go +++ b/pkg/sdn/master/master_test.go @@ -1,4 +1,4 @@ -package plugin +package master import ( "testing" diff --git a/pkg/sdn/plugin/netid/allocator.go b/pkg/sdn/master/netid/allocator.go similarity index 100% rename from pkg/sdn/plugin/netid/allocator.go rename to pkg/sdn/master/netid/allocator.go diff --git a/pkg/sdn/plugin/netid/allocator_test.go b/pkg/sdn/master/netid/allocator_test.go similarity index 100% rename from pkg/sdn/plugin/netid/allocator_test.go rename to pkg/sdn/master/netid/allocator_test.go diff --git a/pkg/sdn/plugin/netid/netid.go b/pkg/sdn/master/netid/netid.go similarity index 100% rename from pkg/sdn/plugin/netid/netid.go rename to pkg/sdn/master/netid/netid.go diff --git a/pkg/sdn/plugin/netid/netid_test.go b/pkg/sdn/master/netid/netid_test.go similarity index 100% rename from pkg/sdn/plugin/netid/netid_test.go rename to pkg/sdn/master/netid/netid_test.go diff --git a/pkg/sdn/plugin/subnets_master.go b/pkg/sdn/master/subnets.go similarity index 99% rename from pkg/sdn/plugin/subnets_master.go rename to pkg/sdn/master/subnets.go index c7c0e0744fc5..1c6954dd0ea5 100644 --- a/pkg/sdn/plugin/subnets_master.go +++ b/pkg/sdn/master/subnets.go @@ -1,4 +1,4 @@ -package plugin +package master import ( "fmt" diff --git a/pkg/sdn/plugin/vnids_master.go b/pkg/sdn/master/vnids.go similarity index 99% rename from pkg/sdn/plugin/vnids_master.go rename to pkg/sdn/master/vnids.go index b060cd73b0a1..05dbbd125eef 100644 --- a/pkg/sdn/plugin/vnids_master.go +++ b/pkg/sdn/master/vnids.go @@ -1,4 +1,4 @@ -package plugin +package master import ( "fmt" @@ -17,7 +17,7 @@ import ( "github.com/openshift/origin/pkg/sdn" osapi "github.com/openshift/origin/pkg/sdn/apis/network" "github.com/openshift/origin/pkg/sdn/common" - pnetid "github.com/openshift/origin/pkg/sdn/plugin/netid" + pnetid "github.com/openshift/origin/pkg/sdn/master/netid" ) type masterVNIDMap struct { diff --git a/pkg/sdn/plugin/vnids_master_test.go b/pkg/sdn/master/vnids_test.go similarity index 99% rename from pkg/sdn/plugin/vnids_master_test.go rename to pkg/sdn/master/vnids_test.go index 67fc17e52b23..81eee352aec1 100644 --- a/pkg/sdn/plugin/vnids_master_test.go +++ b/pkg/sdn/master/vnids_test.go @@ -1,4 +1,4 @@ -package plugin +package master import ( "testing" diff --git a/pkg/sdn/plugin/cniserver/cniserver.go b/pkg/sdn/node/cniserver/cniserver.go similarity index 100% rename from pkg/sdn/plugin/cniserver/cniserver.go rename to pkg/sdn/node/cniserver/cniserver.go diff --git a/pkg/sdn/plugin/cniserver/cniserver_test.go b/pkg/sdn/node/cniserver/cniserver_test.go similarity index 100% rename from pkg/sdn/plugin/cniserver/cniserver_test.go rename to pkg/sdn/node/cniserver/cniserver_test.go diff --git a/pkg/sdn/node/doc.go b/pkg/sdn/node/doc.go new file mode 100644 index 000000000000..c9c66480352d --- /dev/null +++ b/pkg/sdn/node/doc.go @@ -0,0 +1,2 @@ +// Package node contains the OpenShift SDN networking code that runs on the nodes +package node diff --git a/pkg/sdn/plugin/egress_network_policy.go b/pkg/sdn/node/egress_network_policy.go similarity index 99% rename from pkg/sdn/plugin/egress_network_policy.go rename to pkg/sdn/node/egress_network_policy.go index 51587b711f1d..ec06817411f9 100644 --- a/pkg/sdn/plugin/egress_network_policy.go +++ b/pkg/sdn/node/egress_network_policy.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/node_iptables.go b/pkg/sdn/node/iptables.go similarity index 99% rename from pkg/sdn/plugin/node_iptables.go rename to pkg/sdn/node/iptables.go index cada92f6b3ac..269c01998cef 100644 --- a/pkg/sdn/plugin/node_iptables.go +++ b/pkg/sdn/node/iptables.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/multitenant.go b/pkg/sdn/node/multitenant.go similarity index 99% rename from pkg/sdn/plugin/multitenant.go rename to pkg/sdn/node/multitenant.go index a8a8f03d088c..8bb3ea3d8b8f 100644 --- a/pkg/sdn/plugin/multitenant.go +++ b/pkg/sdn/node/multitenant.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "sync" diff --git a/pkg/sdn/plugin/networkpolicy.go b/pkg/sdn/node/networkpolicy.go similarity index 99% rename from pkg/sdn/plugin/networkpolicy.go rename to pkg/sdn/node/networkpolicy.go index 0d724cd21417..9845c9880606 100644 --- a/pkg/sdn/plugin/networkpolicy.go +++ b/pkg/sdn/node/networkpolicy.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/node.go b/pkg/sdn/node/node.go similarity index 99% rename from pkg/sdn/plugin/node.go rename to pkg/sdn/node/node.go index a520fc7817cc..beebf72feacb 100644 --- a/pkg/sdn/plugin/node.go +++ b/pkg/sdn/node/node.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" @@ -13,7 +13,7 @@ import ( log "github.com/golang/glog" - "github.com/openshift/origin/pkg/sdn/plugin/cniserver" + "github.com/openshift/origin/pkg/sdn/node/cniserver" osclient "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/sdn" @@ -112,7 +112,7 @@ type OsdnNode struct { } // Called by higher layers to create the plugin SDN node instance -func NewNodePlugin(c *OsdnNodeConfig) (sdn.NodeInterface, error) { +func New(c *OsdnNodeConfig) (sdn.NodeInterface, error) { var policy osdnPolicy var pluginId int var minOvsVersion string diff --git a/pkg/sdn/plugin/ovscontroller.go b/pkg/sdn/node/ovscontroller.go similarity index 99% rename from pkg/sdn/plugin/ovscontroller.go rename to pkg/sdn/node/ovscontroller.go index eea6bdbfaf8c..085d5ef83d03 100644 --- a/pkg/sdn/plugin/ovscontroller.go +++ b/pkg/sdn/node/ovscontroller.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "encoding/hex" diff --git a/pkg/sdn/plugin/ovscontroller_test.go b/pkg/sdn/node/ovscontroller_test.go similarity index 99% rename from pkg/sdn/plugin/ovscontroller_test.go rename to pkg/sdn/node/ovscontroller_test.go index e1f2c3d84fbb..cbd6364d9f38 100644 --- a/pkg/sdn/plugin/ovscontroller_test.go +++ b/pkg/sdn/node/ovscontroller_test.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/pod.go b/pkg/sdn/node/pod.go similarity index 99% rename from pkg/sdn/plugin/pod.go rename to pkg/sdn/node/pod.go index 766fc4cc1b57..48042747f1e4 100644 --- a/pkg/sdn/plugin/pod.go +++ b/pkg/sdn/node/pod.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "encoding/json" @@ -9,7 +9,7 @@ import ( "syscall" sdnapi "github.com/openshift/origin/pkg/sdn/apis/network" - "github.com/openshift/origin/pkg/sdn/plugin/cniserver" + "github.com/openshift/origin/pkg/sdn/node/cniserver" "github.com/openshift/origin/pkg/util/ipcmd" "github.com/openshift/origin/pkg/util/netutils" diff --git a/pkg/sdn/plugin/pod_test.go b/pkg/sdn/node/pod_test.go similarity index 99% rename from pkg/sdn/plugin/pod_test.go rename to pkg/sdn/node/pod_test.go index 1d05a588426c..5f575b44ed14 100644 --- a/pkg/sdn/plugin/pod_test.go +++ b/pkg/sdn/node/pod_test.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "encoding/json" @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/openshift/origin/pkg/sdn/plugin/cniserver" + "github.com/openshift/origin/pkg/sdn/node/cniserver" utiltesting "k8s.io/client-go/util/testing" khostport "k8s.io/kubernetes/pkg/kubelet/network/hostport" diff --git a/pkg/sdn/plugin/runtime.go b/pkg/sdn/node/runtime.go similarity index 99% rename from pkg/sdn/plugin/runtime.go rename to pkg/sdn/node/runtime.go index 9ba8a5707e6f..e531584f3119 100644 --- a/pkg/sdn/plugin/runtime.go +++ b/pkg/sdn/node/runtime.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/sdn_controller.go b/pkg/sdn/node/sdn_controller.go similarity index 99% rename from pkg/sdn/plugin/sdn_controller.go rename to pkg/sdn/node/sdn_controller.go index 053fee569a71..0e9d481d98cb 100644 --- a/pkg/sdn/plugin/sdn_controller.go +++ b/pkg/sdn/node/sdn_controller.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/singletenant.go b/pkg/sdn/node/singletenant.go similarity index 98% rename from pkg/sdn/plugin/singletenant.go rename to pkg/sdn/node/singletenant.go index 1424b402e0c8..43067e191c42 100644 --- a/pkg/sdn/plugin/singletenant.go +++ b/pkg/sdn/node/singletenant.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "github.com/openshift/origin/pkg/sdn" diff --git a/pkg/sdn/plugin/subnets_node.go b/pkg/sdn/node/subnets.go similarity index 99% rename from pkg/sdn/plugin/subnets_node.go rename to pkg/sdn/node/subnets.go index 67f58fe8810f..f429d4842d48 100644 --- a/pkg/sdn/plugin/subnets_node.go +++ b/pkg/sdn/node/subnets.go @@ -1,4 +1,4 @@ -package plugin +package node import ( log "github.com/golang/glog" diff --git a/pkg/sdn/plugin/vnids_node.go b/pkg/sdn/node/vnids.go similarity index 99% rename from pkg/sdn/plugin/vnids_node.go rename to pkg/sdn/node/vnids.go index 55a34268a340..2b46e2973b1f 100644 --- a/pkg/sdn/plugin/vnids_node.go +++ b/pkg/sdn/node/vnids.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "fmt" diff --git a/pkg/sdn/plugin/vnids_node_test.go b/pkg/sdn/node/vnids_test.go similarity index 99% rename from pkg/sdn/plugin/vnids_node_test.go rename to pkg/sdn/node/vnids_test.go index ce4621649067..6146873d0fc8 100644 --- a/pkg/sdn/plugin/vnids_node_test.go +++ b/pkg/sdn/node/vnids_test.go @@ -1,4 +1,4 @@ -package plugin +package node import ( "testing" diff --git a/pkg/sdn/proxy/doc.go b/pkg/sdn/proxy/doc.go new file mode 100644 index 000000000000..92cb752d608d --- /dev/null +++ b/pkg/sdn/proxy/doc.go @@ -0,0 +1,2 @@ +// Package proxy contains the OpenShift SDN code that runs as part of the service proxy +package proxy diff --git a/pkg/sdn/plugin/proxy.go b/pkg/sdn/proxy/proxy.go similarity index 98% rename from pkg/sdn/plugin/proxy.go rename to pkg/sdn/proxy/proxy.go index 95e2993e9cb9..f7b7be608987 100644 --- a/pkg/sdn/plugin/proxy.go +++ b/pkg/sdn/proxy/proxy.go @@ -1,4 +1,4 @@ -package plugin +package proxy import ( "fmt" @@ -60,7 +60,7 @@ type OsdnProxy struct { } // Called by higher layers to create the proxy plugin instance; only used by nodes -func NewProxyPlugin(pluginName string, osClient *osclient.Client, kClient kclientset.Interface) (sdn.ProxyInterface, error) { +func New(pluginName string, osClient *osclient.Client, kClient kclientset.Interface) (sdn.ProxyInterface, error) { if !sdn.IsOpenShiftMultitenantNetworkPlugin(pluginName) { return nil, nil } diff --git a/pkg/sdn/plugin/sdn-cni-plugin/doc.go b/pkg/sdn/sdn-cni-plugin/doc.go similarity index 100% rename from pkg/sdn/plugin/sdn-cni-plugin/doc.go rename to pkg/sdn/sdn-cni-plugin/doc.go diff --git a/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go b/pkg/sdn/sdn-cni-plugin/openshift-sdn.go similarity index 98% rename from pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go rename to pkg/sdn/sdn-cni-plugin/openshift-sdn.go index fede0f1c61d6..9e1a078850b1 100644 --- a/pkg/sdn/plugin/sdn-cni-plugin/openshift-sdn.go +++ b/pkg/sdn/sdn-cni-plugin/openshift-sdn.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "github.com/openshift/origin/pkg/sdn/plugin/cniserver" + "github.com/openshift/origin/pkg/sdn/node/cniserver" "github.com/containernetworking/cni/pkg/skel" "github.com/containernetworking/cni/pkg/types" diff --git a/pkg/sdn/plugin/sdn-cni-plugin/sdn_cni_plugin_test.go b/pkg/sdn/sdn-cni-plugin/sdn_cni_plugin_test.go similarity index 98% rename from pkg/sdn/plugin/sdn-cni-plugin/sdn_cni_plugin_test.go rename to pkg/sdn/sdn-cni-plugin/sdn_cni_plugin_test.go index faf9f28316b3..53cf3abe0564 100644 --- a/pkg/sdn/plugin/sdn-cni-plugin/sdn_cni_plugin_test.go +++ b/pkg/sdn/sdn-cni-plugin/sdn_cni_plugin_test.go @@ -16,7 +16,7 @@ import ( cnitypes "github.com/containernetworking/cni/pkg/types" cni020 "github.com/containernetworking/cni/pkg/types/020" - "github.com/openshift/origin/pkg/sdn/plugin/cniserver" + "github.com/openshift/origin/pkg/sdn/node/cniserver" utiltesting "k8s.io/client-go/util/testing" )