From e01b7da31a7c387d0ccaac2c88d8ac258d4d4350 Mon Sep 17 00:00:00 2001 From: darthhexx Date: Tue, 19 Apr 2022 21:10:09 +1000 Subject: [PATCH] Switch maoclient -> machineclient and maofake -> machinefake --- cmd/aro/ensurebuildtag_aro.go | 1 + cmd/aro/operator.go | 4 +-- pkg/cluster/cluster.go | 4 +-- pkg/cluster/fixmcsuserdata_test.go | 4 +-- pkg/cluster/install.go | 4 +-- pkg/monitor/cluster/cluster.go | 6 ++-- pkg/monitor/cluster/nodeconditions_test.go | 18 +++++----- .../controllers/checker/checker_controller.go | 4 +-- .../checker/serviceprincipalchecker.go | 6 ++-- .../controllers/machine/machine_controller.go | 6 ++-- .../machine/machine_controller_test.go | 16 ++++----- .../machineset/machineset_controller.go | 6 ++-- .../machineset/machineset_controller_test.go | 12 +++---- .../previewfeature_controller.go | 6 ++-- .../storageaccount_controller.go | 6 ++-- .../controllers/subnets/subnets_controller.go | 6 ++-- pkg/util/clusterdata/worker_profiles_task.go | 6 ++-- .../clusterdata/worker_profiles_task_test.go | 34 +++++++++---------- pkg/util/subnet/cluster_subnets.go | 6 ++-- pkg/util/subnet/cluster_subnets_test.go | 4 +-- test/e2e/setup.go | 6 ++-- 21 files changed, 83 insertions(+), 82 deletions(-) diff --git a/cmd/aro/ensurebuildtag_aro.go b/cmd/aro/ensurebuildtag_aro.go index 584d85f95..d11008f60 100644 --- a/cmd/aro/ensurebuildtag_aro.go +++ b/cmd/aro/ensurebuildtag_aro.go @@ -1,3 +1,4 @@ +//go:build aro // +build aro package main diff --git a/cmd/aro/operator.go b/cmd/aro/operator.go index 23b3bdd40..83a3f8fb0 100644 --- a/cmd/aro/operator.go +++ b/cmd/aro/operator.go @@ -11,7 +11,7 @@ import ( configclient "github.com/openshift/client-go/config/clientset/versioned" consoleclient "github.com/openshift/client-go/console/clientset/versioned" imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" securityclient "github.com/openshift/client-go/security/clientset/versioned" mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned" "github.com/sirupsen/logrus" @@ -92,7 +92,7 @@ func operator(ctx context.Context, log *logrus.Entry) error { if err != nil { return err } - maocli, err := maoclient.NewForConfig(restConfig) + maocli, err := machineclient.NewForConfig(restConfig) if err != nil { return err } diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 678f37e57..6f8773f50 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -9,7 +9,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure" configclient "github.com/openshift/client-go/config/clientset/versioned" imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" operatorclient "github.com/openshift/client-go/operator/clientset/versioned" samplesclient "github.com/openshift/client-go/samples/clientset/versioned" securityclient "github.com/openshift/client-go/security/clientset/versioned" @@ -83,7 +83,7 @@ type manager struct { kubernetescli kubernetes.Interface extensionscli extensionsclient.Interface - maocli maoclient.Interface + maocli machineclient.Interface mcocli mcoclient.Interface operatorcli operatorclient.Interface configcli configclient.Interface diff --git a/pkg/cluster/fixmcsuserdata_test.go b/pkg/cluster/fixmcsuserdata_test.go index e6c5df2dd..7ea4718ba 100644 --- a/pkg/cluster/fixmcsuserdata_test.go +++ b/pkg/cluster/fixmcsuserdata_test.go @@ -11,7 +11,7 @@ import ( "testing" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" @@ -149,7 +149,7 @@ func TestFixMCSUserData(t *testing.T) { userDataSecret(t, "openshift-machine-api", "master-user-data", "https://api-int.example.com:22623/config/master", ""), userDataSecret(t, "openshift-machine-api", "worker-user-data", "", "https://api-int.example.com:22623/config/worker"), ), - maocli: maofake.NewSimpleClientset( + maocli: machinefake.NewSimpleClientset( testMachineSet(t, "openshift-machine-api", "worker", &machinev1beta1.AzureMachineProviderSpec{ UserDataSecret: &corev1.SecretReference{ Name: "worker-user-data", diff --git a/pkg/cluster/install.go b/pkg/cluster/install.go index 1d4bef0c2..f57d18feb 100644 --- a/pkg/cluster/install.go +++ b/pkg/cluster/install.go @@ -10,7 +10,7 @@ import ( configclient "github.com/openshift/client-go/config/clientset/versioned" imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" operatorclient "github.com/openshift/client-go/operator/clientset/versioned" samplesclient "github.com/openshift/client-go/samples/clientset/versioned" securityclient "github.com/openshift/client-go/security/clientset/versioned" @@ -261,7 +261,7 @@ func (m *manager) initializeKubernetesClients(ctx context.Context) error { return err } - m.maocli, err = maoclient.NewForConfig(restConfig) + m.maocli, err = machineclient.NewForConfig(restConfig) if err != nil { return err } diff --git a/pkg/monitor/cluster/cluster.go b/pkg/monitor/cluster/cluster.go index e6a99c8de..149e1cd05 100644 --- a/pkg/monitor/cluster/cluster.go +++ b/pkg/monitor/cluster/cluster.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure" configv1 "github.com/openshift/api/config/v1" configclient "github.com/openshift/client-go/config/clientset/versioned" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned" "github.com/sirupsen/logrus" appsv1 "k8s.io/api/apps/v1" @@ -35,7 +35,7 @@ type Monitor struct { restconfig *rest.Config cli kubernetes.Interface configcli configclient.Interface - maocli maoclient.Interface + maocli machineclient.Interface mcocli mcoclient.Interface m metrics.Emitter arocli aroclient.Interface @@ -72,7 +72,7 @@ func NewMonitor(ctx context.Context, log *logrus.Entry, restConfig *rest.Config, return nil, err } - maocli, err := maoclient.NewForConfig(restConfig) + maocli, err := machineclient.NewForConfig(restConfig) if err != nil { return nil, err } diff --git a/pkg/monitor/cluster/nodeconditions_test.go b/pkg/monitor/cluster/nodeconditions_test.go index c9e760afa..e8d02dcc4 100644 --- a/pkg/monitor/cluster/nodeconditions_test.go +++ b/pkg/monitor/cluster/nodeconditions_test.go @@ -10,8 +10,8 @@ import ( "github.com/golang/mock/gomock" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -68,7 +68,7 @@ func TestEmitNodeConditions(t *testing.T) { }, }, }) - maoclient := maofake.NewSimpleClientset( + machineclient := machinefake.NewSimpleClientset( &machinev1beta1.Machine{ Spec: machinev1beta1.MachineSpec{ ProviderSpec: machinev1beta1.ProviderSpec{ @@ -104,7 +104,7 @@ func TestEmitNodeConditions(t *testing.T) { mon := &Monitor{ cli: cli, - maocli: maoclient, + maocli: machineclient, m: m, } @@ -154,13 +154,13 @@ func TestGetSpotInstances(t *testing.T) { for _, tt := range []struct { name string - maocli maoclient.Interface + maocli machineclient.Interface node corev1.Node expectedSpotInstance bool }{ { name: "node is a spot instance", - maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{ + maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{ Spec: machinev1beta1.MachineSpec{ ProviderSpec: machinev1beta1.ProviderSpec{ Value: &kruntime.RawExtension{ @@ -185,7 +185,7 @@ func TestGetSpotInstances(t *testing.T) { }, { name: "node is not a spot instance", - maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{ + maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{ Spec: machinev1beta1.MachineSpec{ ProviderSpec: machinev1beta1.ProviderSpec{ Value: &kruntime.RawExtension{ @@ -210,7 +210,7 @@ func TestGetSpotInstances(t *testing.T) { }, { name: "node is missing annotation", - maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{ + maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{ Spec: machinev1beta1.MachineSpec{ ProviderSpec: machinev1beta1.ProviderSpec{ Value: &kruntime.RawExtension{ @@ -233,7 +233,7 @@ func TestGetSpotInstances(t *testing.T) { }, { name: "malformed json in providerSpec", - maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{ + maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{ Spec: machinev1beta1.MachineSpec{ ProviderSpec: machinev1beta1.ProviderSpec{ Value: &kruntime.RawExtension{ diff --git a/pkg/operator/controllers/checker/checker_controller.go b/pkg/operator/controllers/checker/checker_controller.go index f6220d491..c40f431d0 100644 --- a/pkg/operator/controllers/checker/checker_controller.go +++ b/pkg/operator/controllers/checker/checker_controller.go @@ -7,7 +7,7 @@ import ( "context" "time" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -37,7 +37,7 @@ type Reconciler struct { arocli aroclient.Interface } -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface, role string) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface, role string) *Reconciler { checkers := []Checker{NewInternetChecker(log, arocli, role)} if role == operator.RoleMaster { diff --git a/pkg/operator/controllers/checker/serviceprincipalchecker.go b/pkg/operator/controllers/checker/serviceprincipalchecker.go index cbe5e054b..e205c206e 100644 --- a/pkg/operator/controllers/checker/serviceprincipalchecker.go +++ b/pkg/operator/controllers/checker/serviceprincipalchecker.go @@ -7,7 +7,7 @@ import ( "context" operatorv1 "github.com/openshift/api/operator/v1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -27,12 +27,12 @@ type ServicePrincipalChecker struct { arocli aroclient.Interface kubernetescli kubernetes.Interface - maocli maoclient.Interface + maocli machineclient.Interface role string } -func NewServicePrincipalChecker(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface, role string) *ServicePrincipalChecker { +func NewServicePrincipalChecker(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface, role string) *ServicePrincipalChecker { return &ServicePrincipalChecker{ log: log, arocli: arocli, diff --git a/pkg/operator/controllers/machine/machine_controller.go b/pkg/operator/controllers/machine/machine_controller.go index 85c298e06..20ddebdd8 100644 --- a/pkg/operator/controllers/machine/machine_controller.go +++ b/pkg/operator/controllers/machine/machine_controller.go @@ -9,7 +9,7 @@ import ( machinev1beta1 "github.com/openshift/api/machine/v1beta1" operatorv1 "github.com/openshift/api/operator/v1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ctrl "sigs.k8s.io/controller-runtime" @@ -31,13 +31,13 @@ type Reconciler struct { log *logrus.Entry arocli aroclient.Interface - maocli maoclient.Interface + maocli machineclient.Interface isLocalDevelopmentMode bool role string } -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface, isLocalDevelopmentMode bool, role string) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface, isLocalDevelopmentMode bool, role string) *Reconciler { return &Reconciler{ log: log, arocli: arocli, diff --git a/pkg/operator/controllers/machine/machine_controller_test.go b/pkg/operator/controllers/machine/machine_controller_test.go index 54424d7cf..1a113db4b 100644 --- a/pkg/operator/controllers/machine/machine_controller_test.go +++ b/pkg/operator/controllers/machine/machine_controller_test.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/go-autorest/autorest/to" machinev1beta1 "github.com/openshift/api/machine/v1beta1" operatorv1 "github.com/openshift/api/operator/v1" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" @@ -24,7 +24,7 @@ import ( func TestMachineReconciler(t *testing.T) { // Fake cluster with AZs - newFakeMao1 := func(diskSize, imagePublisher, vmSize, masterVmSize string) *maofake.Clientset { + newFakeMao1 := func(diskSize, imagePublisher, vmSize, masterVmSize string) *machinefake.Clientset { master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true) master1 := getValidMachine("foo-hx8z7-master-1", "", "", "", "", true) master2 := getValidMachine("foo-hx8z7-master-2", "", "", masterVmSize, "", true) @@ -35,11 +35,11 @@ func TestMachineReconciler(t *testing.T) { workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1") workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2") - return maofake.NewSimpleClientset(worker0, worker1, worker2, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) + return machinefake.NewSimpleClientset(worker0, worker1, worker2, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) } // Fake cluster missing a master - newFakeMao2 := func() *maofake.Clientset { + newFakeMao2 := func() *machinefake.Clientset { master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true) master2 := getValidMachine("foo-hx8z7-master-2", "", "", "", "", true) worker0 := getValidMachine("foo-hx8z7-worker-0", "", "", "", "", false) @@ -49,11 +49,11 @@ func TestMachineReconciler(t *testing.T) { workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1") workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2") - return maofake.NewSimpleClientset(worker0, worker1, worker2, master0, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) + return machinefake.NewSimpleClientset(worker0, worker1, worker2, master0, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) } // Fake cluster missing a worker - newFakeMao3 := func() *maofake.Clientset { + newFakeMao3 := func() *machinefake.Clientset { master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true) master1 := getValidMachine("foo-hx8z7-master-1", "", "", "", "", true) master2 := getValidMachine("foo-hx8z7-master-2", "", "", "", "", true) @@ -63,7 +63,7 @@ func TestMachineReconciler(t *testing.T) { workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1") workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2") - return maofake.NewSimpleClientset(worker0, worker1, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) + return machinefake.NewSimpleClientset(worker0, worker1, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2) } baseCluster := arov1alpha1.Cluster{ @@ -79,7 +79,7 @@ func TestMachineReconciler(t *testing.T) { tests := []struct { name string request ctrl.Request - maocli *maofake.Clientset + maocli *machinefake.Clientset arocli *arofake.Clientset wantConditions []operatorv1.OperatorCondition }{ diff --git a/pkg/operator/controllers/machineset/machineset_controller.go b/pkg/operator/controllers/machineset/machineset_controller.go index 5f4cd0096..bd47cb0dc 100644 --- a/pkg/operator/controllers/machineset/machineset_controller.go +++ b/pkg/operator/controllers/machineset/machineset_controller.go @@ -9,7 +9,7 @@ import ( "github.com/Azure/go-autorest/autorest/to" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,11 +33,11 @@ type Reconciler struct { log *logrus.Entry arocli aroclient.Interface - maocli maoclient.Interface + maocli machineclient.Interface } // MachineSet reconciler watches MachineSet objects for changes, evaluates total worker replica count, and reverts changes if needed. -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface) *Reconciler { return &Reconciler{ log: log, arocli: arocli, diff --git a/pkg/operator/controllers/machineset/machineset_controller_test.go b/pkg/operator/controllers/machineset/machineset_controller_test.go index a826fe897..527843f42 100644 --- a/pkg/operator/controllers/machineset/machineset_controller_test.go +++ b/pkg/operator/controllers/machineset/machineset_controller_test.go @@ -11,7 +11,7 @@ import ( "github.com/Azure/go-autorest/autorest/to" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" "github.com/sirupsen/logrus" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -69,7 +69,7 @@ func TestReconciler(t *testing.T) { name string objectName string machinesets []kruntime.Object - mocks func(maocli *maofake.Clientset) + mocks func(maocli *machinefake.Clientset) wantReplicas int32 featureFlag bool assertReplicas bool @@ -149,7 +149,7 @@ func TestReconciler(t *testing.T) { name: "machineset-0 not found", objectName: "aro-fake-machineset-0", machinesets: fakeMachineSets(2, 0, 0), - mocks: func(maocli *maofake.Clientset) { + mocks: func(maocli *machinefake.Clientset) { maocli.PrependReactor("get", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) { return true, nil, &kerrors.StatusError{ErrStatus: metav1.Status{ Message: "machineset-0 not found", @@ -165,7 +165,7 @@ func TestReconciler(t *testing.T) { name: "get machinesets failed with error", objectName: "aro-fake-machineset-0", machinesets: fakeMachineSets(1, 0, 0), - mocks: func(maocli *maofake.Clientset) { + mocks: func(maocli *machinefake.Clientset) { maocli.PrependReactor("get", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) { return true, nil, errors.New("fake error") }) @@ -178,7 +178,7 @@ func TestReconciler(t *testing.T) { name: "machineset-0 can't be updated", objectName: "aro-fake-machineset-0", machinesets: fakeMachineSets(1, 0, 0), - mocks: func(maocli *maofake.Clientset) { + mocks: func(maocli *machinefake.Clientset) { maocli.PrependReactor("update", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) { return true, nil, errors.New("fake error from update") }) @@ -201,7 +201,7 @@ func TestReconciler(t *testing.T) { }, } - maocli := maofake.NewSimpleClientset(tt.machinesets...) + maocli := machinefake.NewSimpleClientset(tt.machinesets...) if tt.mocks != nil { tt.mocks(maocli) diff --git a/pkg/operator/controllers/previewfeature/previewfeature_controller.go b/pkg/operator/controllers/previewfeature/previewfeature_controller.go index 707a973c4..781199c91 100644 --- a/pkg/operator/controllers/previewfeature/previewfeature_controller.go +++ b/pkg/operator/controllers/previewfeature/previewfeature_controller.go @@ -7,7 +7,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest/azure" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -41,10 +41,10 @@ type Reconciler struct { arocli aroclient.Interface kubernetescli kubernetes.Interface - maocli maoclient.Interface + maocli machineclient.Interface } -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface) *Reconciler { return &Reconciler{ log: log, arocli: arocli, diff --git a/pkg/operator/controllers/storageaccounts/storageaccount_controller.go b/pkg/operator/controllers/storageaccounts/storageaccount_controller.go index 1871a211a..6649726e6 100644 --- a/pkg/operator/controllers/storageaccounts/storageaccount_controller.go +++ b/pkg/operator/controllers/storageaccounts/storageaccount_controller.go @@ -9,7 +9,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure" machinev1beta1 "github.com/openshift/api/machine/v1beta1" imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -42,7 +42,7 @@ type Reconciler struct { arocli aroclient.Interface kubernetescli kubernetes.Interface - maocli maoclient.Interface + maocli machineclient.Interface imageregistrycli imageregistryclient.Interface } @@ -59,7 +59,7 @@ type reconcileManager struct { } // NewReconciler creates a new Reconciler -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface, kubernetescli kubernetes.Interface, imageregistrycli imageregistryclient.Interface) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface, kubernetescli kubernetes.Interface, imageregistrycli imageregistryclient.Interface) *Reconciler { return &Reconciler{ log: log, arocli: arocli, diff --git a/pkg/operator/controllers/subnets/subnets_controller.go b/pkg/operator/controllers/subnets/subnets_controller.go index b136d2974..864e4fd4d 100644 --- a/pkg/operator/controllers/subnets/subnets_controller.go +++ b/pkg/operator/controllers/subnets/subnets_controller.go @@ -10,7 +10,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -44,7 +44,7 @@ type Reconciler struct { arocli aroclient.Interface kubernetescli kubernetes.Interface - maocli maoclient.Interface + maocli machineclient.Interface } // reconcileManager is an instance of the manager instantiated per request @@ -59,7 +59,7 @@ type reconcileManager struct { } // NewReconciler creates a new Reconciler -func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface) *Reconciler { +func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface) *Reconciler { return &Reconciler{ log: log, arocli: arocli, diff --git a/pkg/util/clusterdata/worker_profiles_task.go b/pkg/util/clusterdata/worker_profiles_task.go index bd5795909..1dc15bd6f 100644 --- a/pkg/util/clusterdata/worker_profiles_task.go +++ b/pkg/util/clusterdata/worker_profiles_task.go @@ -10,7 +10,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" @@ -25,7 +25,7 @@ const ( ) func newWorkerProfilesEnricherTask(log *logrus.Entry, restConfig *rest.Config, oc *api.OpenShiftCluster) (enricherTask, error) { - maocli, err := maoclient.NewForConfig(restConfig) + maocli, err := machineclient.NewForConfig(restConfig) if err != nil { return nil, err } @@ -39,7 +39,7 @@ func newWorkerProfilesEnricherTask(log *logrus.Entry, restConfig *rest.Config, o type workerProfilesEnricherTask struct { log *logrus.Entry - maocli maoclient.Interface + maocli machineclient.Interface oc *api.OpenShiftCluster } diff --git a/pkg/util/clusterdata/worker_profiles_task_test.go b/pkg/util/clusterdata/worker_profiles_task_test.go index 54bcea064..5a8b7f685 100644 --- a/pkg/util/clusterdata/worker_profiles_task_test.go +++ b/pkg/util/clusterdata/worker_profiles_task_test.go @@ -12,8 +12,8 @@ import ( "github.com/Azure/go-autorest/autorest/to" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" @@ -40,15 +40,15 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { for _, tt := range []struct { name string - client func() maoclient.Interface + client func() machineclient.Interface modifyOc func(*api.OpenShiftCluster) wantOc *api.OpenShiftCluster wantErr string }{ { name: "machine set objects exists - valid provider spec JSON", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset( + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset( &machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ Name: "fake-worker-profile-1", @@ -136,8 +136,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "machine set objects exists - invalid provider spec JSON", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset( + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset( &machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ Name: "fake-worker-profile-1", @@ -166,8 +166,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "machine set objects exists - provider spec is missing", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset( + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset( &machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ Name: "fake-worker-profile-1", @@ -185,8 +185,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "machine set objects exists - provider spec is missing raw value", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset( + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset( &machinev1beta1.MachineSet{ ObjectMeta: metav1.ObjectMeta{ Name: "fake-worker-profile-1", @@ -213,8 +213,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "machine set objects do not exist", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset() + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset() }, wantOc: &api.OpenShiftCluster{ ID: clusterID, @@ -225,8 +225,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "machine set list request failed", - client: func() maoclient.Interface { - client := maofake.NewSimpleClientset() + client: func() machineclient.Interface { + client := machinefake.NewSimpleClientset() client.PrependReactor("list", "machinesets", func(action ktesting.Action) (bool, kruntime.Object, error) { return true, nil, errors.New("fake list error") }) @@ -239,8 +239,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) { }, { name: "invalid cluster object", - client: func() maoclient.Interface { - return maofake.NewSimpleClientset() + client: func() machineclient.Interface { + return machinefake.NewSimpleClientset() }, modifyOc: func(oc *api.OpenShiftCluster) { oc.ID = "invalid" diff --git a/pkg/util/subnet/cluster_subnets.go b/pkg/util/subnet/cluster_subnets.go index f843f3c23..70f3ba9b5 100644 --- a/pkg/util/subnet/cluster_subnets.go +++ b/pkg/util/subnet/cluster_subnets.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/Azure/go-autorest/autorest/azure" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" azureproviderv1beta1 "sigs.k8s.io/cluster-api-provider-azure/pkg/apis/azureprovider/v1beta1" @@ -21,12 +21,12 @@ type KubeManager interface { } type kubeManager struct { - maocli maoclient.Interface + maocli machineclient.Interface subscriptionID string } -func NewKubeManager(maocli maoclient.Interface, subscriptionID string) KubeManager { +func NewKubeManager(maocli machineclient.Interface, subscriptionID string) KubeManager { return &kubeManager{ maocli: maocli, subscriptionID: subscriptionID, diff --git a/pkg/util/subnet/cluster_subnets_test.go b/pkg/util/subnet/cluster_subnets_test.go index 7f479779f..d5953df72 100644 --- a/pkg/util/subnet/cluster_subnets_test.go +++ b/pkg/util/subnet/cluster_subnets_test.go @@ -9,7 +9,7 @@ import ( "github.com/google/go-cmp/cmp" machinev1beta1 "github.com/openshift/api/machine/v1beta1" - maofake "github.com/openshift/client-go/machine/clientset/versioned/fake" + machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kruntime "k8s.io/apimachinery/pkg/runtime" ) @@ -93,7 +93,7 @@ func TestListFromCluster(t *testing.T) { } m := kubeManager{ - maocli: maofake.NewSimpleClientset(&workerMachine, &masterMachine), + maocli: machinefake.NewSimpleClientset(&workerMachine, &masterMachine), subscriptionID: subscriptionId, } diff --git a/test/e2e/setup.go b/test/e2e/setup.go index 8dab94384..c57d754ee 100644 --- a/test/e2e/setup.go +++ b/test/e2e/setup.go @@ -13,7 +13,7 @@ import ( . "github.com/onsi/gomega" "github.com/Azure/go-autorest/autorest/azure/auth" - maoclient "github.com/openshift/client-go/machine/clientset/versioned" + machineclient "github.com/openshift/client-go/machine/clientset/versioned" projectclient "github.com/openshift/client-go/project/clientset/versioned" mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned" "github.com/sirupsen/logrus" @@ -53,7 +53,7 @@ type clientSet struct { RestConfig *rest.Config Kubernetes kubernetes.Interface - MachineAPI maoclient.Interface + MachineAPI machineclient.Interface MachineConfig mcoclient.Interface AROClusters aroclient.Interface Project projectclient.Interface @@ -108,7 +108,7 @@ func newClientSet(ctx context.Context) (*clientSet, error) { return nil, err } - machineapicli, err := maoclient.NewForConfig(restconfig) + machineapicli, err := machineclient.NewForConfig(restconfig) if err != nil { return nil, err }