From 64a02672e04622a556a551a1dfc518ff4c0c216b Mon Sep 17 00:00:00 2001 From: akutz Date: Tue, 19 Nov 2019 08:53:50 -0600 Subject: [PATCH] Simplify package layout This patch simplifies the package layout by moving all of the packages once located at "pkg/cloud/vsphere" directly into "pkg". The previous layout is a vestigial artifact of when the providers all lived in a single repository, and that is no longer the case. --- controllers/vspherecluster_controller.go | 8 ++++---- controllers/vspheremachine_controller.go | 8 ++++---- main.go | 2 +- pkg/{cloud/vsphere => }/config/config.go | 0 pkg/{cloud/vsphere => }/constants/constants.go | 0 pkg/{cloud/vsphere => }/context/cluster_context.go | 0 pkg/{cloud/vsphere => }/context/machine_context.go | 0 pkg/{cloud/vsphere => }/context/session.go | 0 .../services/cloudprovider/cloud-controller-manager.go | 0 pkg/{cloud/vsphere => }/services/cloudprovider/csi.go | 2 +- pkg/{cloud/vsphere => }/services/govmomi/constants.go | 0 pkg/{cloud/vsphere => }/services/govmomi/create.go | 6 +++--- pkg/{cloud/vsphere => }/services/govmomi/create_test.go | 2 +- pkg/{cloud/vsphere => }/services/govmomi/esxi/clone.go | 2 +- pkg/{cloud/vsphere => }/services/govmomi/extra/config.go | 0 pkg/{cloud/vsphere => }/services/govmomi/net/net.go | 0 pkg/{cloud/vsphere => }/services/govmomi/net/net_test.go | 2 +- pkg/{cloud/vsphere => }/services/govmomi/service.go | 8 ++++---- .../vsphere => }/services/govmomi/template/template.go | 2 +- pkg/{cloud/vsphere => }/services/govmomi/util.go | 4 ++-- pkg/{cloud/vsphere => }/services/govmomi/vcenter/clone.go | 6 +++--- pkg/{cloud/vsphere => }/services/interfaces.go | 2 +- pkg/{cloud/vsphere => }/util/constants.go | 0 pkg/{cloud/vsphere => }/util/kubeadm.go | 0 pkg/{cloud/vsphere => }/util/kubeadm_test.go | 2 +- pkg/{cloud/vsphere => }/util/kubeclient.go | 0 pkg/{cloud/vsphere => }/util/machines.go | 0 pkg/{cloud/vsphere => }/util/machines_test.go | 2 +- 28 files changed, 29 insertions(+), 29 deletions(-) rename pkg/{cloud/vsphere => }/config/config.go (100%) rename pkg/{cloud/vsphere => }/constants/constants.go (100%) rename pkg/{cloud/vsphere => }/context/cluster_context.go (100%) rename pkg/{cloud/vsphere => }/context/machine_context.go (100%) rename pkg/{cloud/vsphere => }/context/session.go (100%) rename pkg/{cloud/vsphere => }/services/cloudprovider/cloud-controller-manager.go (100%) rename pkg/{cloud/vsphere => }/services/cloudprovider/csi.go (99%) rename pkg/{cloud/vsphere => }/services/govmomi/constants.go (100%) rename pkg/{cloud/vsphere => }/services/govmomi/create.go (76%) rename pkg/{cloud/vsphere => }/services/govmomi/create_test.go (98%) rename pkg/{cloud/vsphere => }/services/govmomi/esxi/clone.go (92%) rename pkg/{cloud/vsphere => }/services/govmomi/extra/config.go (100%) rename pkg/{cloud/vsphere => }/services/govmomi/net/net.go (100%) rename pkg/{cloud/vsphere => }/services/govmomi/net/net_test.go (95%) rename pkg/{cloud/vsphere => }/services/govmomi/service.go (97%) rename pkg/{cloud/vsphere => }/services/govmomi/template/template.go (96%) rename pkg/{cloud/vsphere => }/services/govmomi/util.go (96%) rename pkg/{cloud/vsphere => }/services/govmomi/vcenter/clone.go (96%) rename pkg/{cloud/vsphere => }/services/interfaces.go (93%) rename pkg/{cloud/vsphere => }/util/constants.go (100%) rename pkg/{cloud/vsphere => }/util/kubeadm.go (100%) rename pkg/{cloud/vsphere => }/util/kubeadm_test.go (98%) rename pkg/{cloud/vsphere => }/util/kubeclient.go (100%) rename pkg/{cloud/vsphere => }/util/machines.go (100%) rename pkg/{cloud/vsphere => }/util/machines_test.go (99%) diff --git a/controllers/vspherecluster_controller.go b/controllers/vspherecluster_controller.go index 0193a25670a7..01af6f4ba326 100644 --- a/controllers/vspherecluster_controller.go +++ b/controllers/vspherecluster_controller.go @@ -32,10 +32,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/config" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/cloudprovider" - infrautilv1 "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/util" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/config" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/cloudprovider" + infrautilv1 "sigs.k8s.io/cluster-api-provider-vsphere/pkg/util" ) const ( diff --git a/controllers/vspheremachine_controller.go b/controllers/vspheremachine_controller.go index a8ce09c1ab1c..d2520d031881 100644 --- a/controllers/vspheremachine_controller.go +++ b/controllers/vspheremachine_controller.go @@ -35,10 +35,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/source" infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/config" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/config" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi" ) // VSphereMachineReconciler reconciles a VSphereMachine object diff --git a/main.go b/main.go index 2353498eaf22..006864462bef 100644 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ import ( infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" "sigs.k8s.io/cluster-api-provider-vsphere/controllers" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/config" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/config" "sigs.k8s.io/cluster-api-provider-vsphere/pkg/record" ) diff --git a/pkg/cloud/vsphere/config/config.go b/pkg/config/config.go similarity index 100% rename from pkg/cloud/vsphere/config/config.go rename to pkg/config/config.go diff --git a/pkg/cloud/vsphere/constants/constants.go b/pkg/constants/constants.go similarity index 100% rename from pkg/cloud/vsphere/constants/constants.go rename to pkg/constants/constants.go diff --git a/pkg/cloud/vsphere/context/cluster_context.go b/pkg/context/cluster_context.go similarity index 100% rename from pkg/cloud/vsphere/context/cluster_context.go rename to pkg/context/cluster_context.go diff --git a/pkg/cloud/vsphere/context/machine_context.go b/pkg/context/machine_context.go similarity index 100% rename from pkg/cloud/vsphere/context/machine_context.go rename to pkg/context/machine_context.go diff --git a/pkg/cloud/vsphere/context/session.go b/pkg/context/session.go similarity index 100% rename from pkg/cloud/vsphere/context/session.go rename to pkg/context/session.go diff --git a/pkg/cloud/vsphere/services/cloudprovider/cloud-controller-manager.go b/pkg/services/cloudprovider/cloud-controller-manager.go similarity index 100% rename from pkg/cloud/vsphere/services/cloudprovider/cloud-controller-manager.go rename to pkg/services/cloudprovider/cloud-controller-manager.go diff --git a/pkg/cloud/vsphere/services/cloudprovider/csi.go b/pkg/services/cloudprovider/csi.go similarity index 99% rename from pkg/cloud/vsphere/services/cloudprovider/csi.go rename to pkg/services/cloudprovider/csi.go index 43421d6f50ad..e48254650f0b 100644 --- a/pkg/cloud/vsphere/services/cloudprovider/csi.go +++ b/pkg/services/cloudprovider/csi.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2/cloudprovider" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" ) // NOTE: the contents of this file are derived from https://github.com/kubernetes-sigs/vsphere-csi-driver/tree/master/manifests/1.14 diff --git a/pkg/cloud/vsphere/services/govmomi/constants.go b/pkg/services/govmomi/constants.go similarity index 100% rename from pkg/cloud/vsphere/services/govmomi/constants.go rename to pkg/services/govmomi/constants.go diff --git a/pkg/cloud/vsphere/services/govmomi/create.go b/pkg/services/govmomi/create.go similarity index 76% rename from pkg/cloud/vsphere/services/govmomi/create.go rename to pkg/services/govmomi/create.go index 9d0200198720..a814c1d0096d 100644 --- a/pkg/cloud/vsphere/services/govmomi/create.go +++ b/pkg/services/govmomi/create.go @@ -17,9 +17,9 @@ limitations under the License. package govmomi import ( - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/esxi" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/vcenter" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/esxi" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/vcenter" ) func createVM(ctx *context.MachineContext, bootstrapData []byte) error { diff --git a/pkg/cloud/vsphere/services/govmomi/create_test.go b/pkg/services/govmomi/create_test.go similarity index 98% rename from pkg/cloud/vsphere/services/govmomi/create_test.go rename to pkg/services/govmomi/create_test.go index 0eed7aaf770d..c8aafbf87ad8 100644 --- a/pkg/cloud/vsphere/services/govmomi/create_test.go +++ b/pkg/services/govmomi/create_test.go @@ -29,7 +29,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha2" infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" ) func init() { diff --git a/pkg/cloud/vsphere/services/govmomi/esxi/clone.go b/pkg/services/govmomi/esxi/clone.go similarity index 92% rename from pkg/cloud/vsphere/services/govmomi/esxi/clone.go rename to pkg/services/govmomi/esxi/clone.go index 0c152811b481..3c9a09f84bf1 100644 --- a/pkg/cloud/vsphere/services/govmomi/esxi/clone.go +++ b/pkg/services/govmomi/esxi/clone.go @@ -19,7 +19,7 @@ package esxi import ( "github.com/pkg/errors" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" ) // Clone kicks off a clone operation on ESXi to create a new virtual machine. diff --git a/pkg/cloud/vsphere/services/govmomi/extra/config.go b/pkg/services/govmomi/extra/config.go similarity index 100% rename from pkg/cloud/vsphere/services/govmomi/extra/config.go rename to pkg/services/govmomi/extra/config.go diff --git a/pkg/cloud/vsphere/services/govmomi/net/net.go b/pkg/services/govmomi/net/net.go similarity index 100% rename from pkg/cloud/vsphere/services/govmomi/net/net.go rename to pkg/services/govmomi/net/net.go diff --git a/pkg/cloud/vsphere/services/govmomi/net/net_test.go b/pkg/services/govmomi/net/net_test.go similarity index 95% rename from pkg/cloud/vsphere/services/govmomi/net/net_test.go rename to pkg/services/govmomi/net/net_test.go index 248a77486390..d8cf250339da 100644 --- a/pkg/cloud/vsphere/services/govmomi/net/net_test.go +++ b/pkg/services/govmomi/net/net_test.go @@ -19,7 +19,7 @@ package net_test import ( "testing" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/net" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/net" ) func TestErrOnLocalOnlyIPAddr(t *testing.T) { diff --git a/pkg/cloud/vsphere/services/govmomi/service.go b/pkg/services/govmomi/service.go similarity index 97% rename from pkg/cloud/vsphere/services/govmomi/service.go rename to pkg/services/govmomi/service.go index 6af7bf5f85ef..2d54b708c237 100644 --- a/pkg/cloud/vsphere/services/govmomi/service.go +++ b/pkg/services/govmomi/service.go @@ -26,10 +26,10 @@ import ( "github.com/vmware/govmomi/vim25/types" infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/extra" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/net" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/util" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/extra" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/net" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/util" ) // VMService provdes API to interact with the VMs using govmomi diff --git a/pkg/cloud/vsphere/services/govmomi/template/template.go b/pkg/services/govmomi/template/template.go similarity index 96% rename from pkg/cloud/vsphere/services/govmomi/template/template.go rename to pkg/services/govmomi/template/template.go index 268733014933..a963f0235f22 100644 --- a/pkg/cloud/vsphere/services/govmomi/template/template.go +++ b/pkg/services/govmomi/template/template.go @@ -24,7 +24,7 @@ import ( "github.com/pkg/errors" "github.com/vmware/govmomi/object" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" ) type tplContext interface { diff --git a/pkg/cloud/vsphere/services/govmomi/util.go b/pkg/services/govmomi/util.go similarity index 96% rename from pkg/cloud/vsphere/services/govmomi/util.go rename to pkg/services/govmomi/util.go index 30a238adf5de..5eff23e72082 100644 --- a/pkg/cloud/vsphere/services/govmomi/util.go +++ b/pkg/services/govmomi/util.go @@ -22,8 +22,8 @@ import ( "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/net" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/net" ) func sanitizeIPAddrs(ctx *context.MachineContext, ipAddrs []string) []string { diff --git a/pkg/cloud/vsphere/services/govmomi/vcenter/clone.go b/pkg/services/govmomi/vcenter/clone.go similarity index 96% rename from pkg/cloud/vsphere/services/govmomi/vcenter/clone.go rename to pkg/services/govmomi/vcenter/clone.go index 71196c437306..ba9098a8bb74 100644 --- a/pkg/cloud/vsphere/services/govmomi/vcenter/clone.go +++ b/pkg/services/govmomi/vcenter/clone.go @@ -21,9 +21,9 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/extra" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/services/govmomi/template" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/extra" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/template" ) const ( diff --git a/pkg/cloud/vsphere/services/interfaces.go b/pkg/services/interfaces.go similarity index 93% rename from pkg/cloud/vsphere/services/interfaces.go rename to pkg/services/interfaces.go index 122b1d6c3371..4bb867c25a5d 100644 --- a/pkg/cloud/vsphere/services/interfaces.go +++ b/pkg/services/interfaces.go @@ -18,7 +18,7 @@ package services import ( infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/context" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/context" ) // VirtualMachineService is a service for creating/updating/deleting virtual diff --git a/pkg/cloud/vsphere/util/constants.go b/pkg/util/constants.go similarity index 100% rename from pkg/cloud/vsphere/util/constants.go rename to pkg/util/constants.go diff --git a/pkg/cloud/vsphere/util/kubeadm.go b/pkg/util/kubeadm.go similarity index 100% rename from pkg/cloud/vsphere/util/kubeadm.go rename to pkg/util/kubeadm.go diff --git a/pkg/cloud/vsphere/util/kubeadm_test.go b/pkg/util/kubeadm_test.go similarity index 98% rename from pkg/cloud/vsphere/util/kubeadm_test.go rename to pkg/util/kubeadm_test.go index 1cf33d81d58d..0b62727c006c 100644 --- a/pkg/cloud/vsphere/util/kubeadm_test.go +++ b/pkg/util/kubeadm_test.go @@ -23,7 +23,7 @@ import ( "github.com/pkg/errors" infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/util" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/util" ) func TestGetAPIEndpointForControlPlaneEndpoint(t *testing.T) { diff --git a/pkg/cloud/vsphere/util/kubeclient.go b/pkg/util/kubeclient.go similarity index 100% rename from pkg/cloud/vsphere/util/kubeclient.go rename to pkg/util/kubeclient.go diff --git a/pkg/cloud/vsphere/util/machines.go b/pkg/util/machines.go similarity index 100% rename from pkg/cloud/vsphere/util/machines.go rename to pkg/util/machines.go diff --git a/pkg/cloud/vsphere/util/machines_test.go b/pkg/util/machines_test.go similarity index 99% rename from pkg/cloud/vsphere/util/machines_test.go rename to pkg/util/machines_test.go index 885bf830cf4b..1ffd5665217b 100644 --- a/pkg/cloud/vsphere/util/machines_test.go +++ b/pkg/util/machines_test.go @@ -22,7 +22,7 @@ import ( corev1 "k8s.io/api/core/v1" "sigs.k8s.io/cluster-api-provider-vsphere/api/v1alpha2" - "sigs.k8s.io/cluster-api-provider-vsphere/pkg/cloud/vsphere/util" + "sigs.k8s.io/cluster-api-provider-vsphere/pkg/util" ) func Test_GetMachinePreferredIPAddress(t *testing.T) {