diff --git a/cloud/scope/client.go b/cloud/scope/client.go index 35ada012e..2ba432406 100644 --- a/cloud/scope/client.go +++ b/cloud/scope/client.go @@ -10,7 +10,7 @@ import ( // LinodeClient is an interface that defines the methods that a Linode client must have to interact with Linode. // It defines all the functions that are required to create, delete, and get resources // from Linode such as object storage buckets, node balancers, linodes, and VPCs. -type MachineScopeLinodeClient interface { +type MachineLinodeClient interface { LinodeNodeBalancerClient LinodeInstanceClient LinodeVPCClient @@ -53,7 +53,7 @@ type LinodeObjectStorageClient interface { DeleteObjectStorageKey(ctx context.Context, keyID int) error } -type LinodeObjectStorageBucketBuilder func(apiKey string) (LinodeObjectStorageClient, error) +type LinodeObjectStorageClientBuilder func(apiKey string) (LinodeObjectStorageClient, error) func CreateLinodeObjectStorageBucketClient(apiKey string) (LinodeObjectStorageClient, error) { return CreateLinodeClient(apiKey) diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 2594d290d..97b41bad6 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -28,7 +28,7 @@ type MachineScope struct { PatchHelper *patch.Helper Cluster *clusterv1.Cluster Machine *clusterv1.Machine - LinodeClient MachineScopeLinodeClient + LinodeClient MachineLinodeClient LinodeCluster *infrav1alpha1.LinodeCluster LinodeMachine *infrav1alpha1.LinodeMachine } diff --git a/cloud/scope/object_storage_bucket.go b/cloud/scope/object_storage_bucket.go index 9e3bac7fa..93e6be7d6 100644 --- a/cloud/scope/object_storage_bucket.go +++ b/cloud/scope/object_storage_bucket.go @@ -17,7 +17,7 @@ import ( type ObjectStorageBucketScopeParams struct { Client k8sClient - LinodeClientBuilder LinodeObjectStorageBucketBuilder + LinodeClientBuilder LinodeObjectStorageClientBuilder Bucket *infrav1alpha1.LinodeObjectStorageBucket Logger *logr.Logger } diff --git a/cloud/services/loadbalancers.go b/cloud/services/loadbalancers.go index 60541ce24..5f81f216e 100644 --- a/cloud/services/loadbalancers.go +++ b/cloud/services/loadbalancers.go @@ -115,10 +115,6 @@ func AddNodeToNB( return nil } - if machineScope.LinodeMachine.Spec.InstanceID == nil { - return errors.New("no InstanceID set for LinodeMachine.Spec") - } - // Get the private IP that was assigned addresses, err := machineScope.LinodeClient.GetInstanceIPAddresses(ctx, *machineScope.LinodeMachine.Spec.InstanceID) if err != nil { @@ -145,13 +141,6 @@ func AddNodeToNB( return err } - if machineScope.LinodeCluster.Spec.Network.NodeBalancerID == nil { - err := errors.New("nil NodeBalancer ID") - logger.Error(err, "NodeBalancer ID is nil") - - return err - } - _, err = machineScope.LinodeClient.CreateNodeBalancerNode( ctx, *machineScope.LinodeCluster.Spec.Network.NodeBalancerID, @@ -182,10 +171,6 @@ func DeleteNodeFromNB( return nil } - if machineScope.LinodeMachine.Spec.InstanceID == nil { - return errors.New("no InstanceID set for LinodeMachine.Spec") - } - if machineScope.LinodeCluster.Spec.ControlPlaneEndpoint.Host == "" { logger.Info("NodeBalancer already deleted, no NodeBalancer backend Node to remove") diff --git a/cloud/services/loadbalancers_test.go b/cloud/services/loadbalancers_test.go index a817b0b50..9c7289169 100644 --- a/cloud/services/loadbalancers_test.go +++ b/cloud/services/loadbalancers_test.go @@ -25,7 +25,7 @@ func TestCreateNodeBalancer(t *testing.T) { clusterScope *scope.ClusterScope want *linodego.NodeBalancer wantErr bool - expects func(mock *mock.MockMachineScopeLinodeClient) + expects func(mock *mock.MockMachineLinodeClient) expectedNodeBalancer *linodego.NodeBalancer expectedError error }{ @@ -44,7 +44,7 @@ func TestCreateNodeBalancer(t *testing.T) { }, }, }, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return([]linodego.NodeBalancer{}, nil) mock.EXPECT().CreateNodeBalancer(gomock.Any(), gomock.Any()).Return(&linodego.NodeBalancer{ ID: 1234, @@ -70,7 +70,7 @@ func TestCreateNodeBalancer(t *testing.T) { }, }, }, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return([]linodego.NodeBalancer{ { ID: 1234, @@ -101,7 +101,7 @@ func TestCreateNodeBalancer(t *testing.T) { }, }, }, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return([]linodego.NodeBalancer{ { ID: 1234, @@ -132,7 +132,7 @@ func TestCreateNodeBalancer(t *testing.T) { }, }, }, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("Unable to list NodeBalancers")) }, expectedNodeBalancer: nil, @@ -153,7 +153,7 @@ func TestCreateNodeBalancer(t *testing.T) { }, }, }, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return([]linodego.NodeBalancer{}, nil) mock.EXPECT().CreateNodeBalancer(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("Unable to create NodeBalancer")) }, @@ -169,11 +169,11 @@ func TestCreateNodeBalancer(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - MockMachineScopeLinodeClient := mock.NewMockMachineScopeLinodeClient(ctrl) + MockMachineLinodeClient := mock.NewMockMachineLinodeClient(ctrl) - testcase.clusterScope.LinodeClient = MockMachineScopeLinodeClient + testcase.clusterScope.LinodeClient = MockMachineLinodeClient - testcase.expects(MockMachineScopeLinodeClient) + testcase.expects(MockMachineLinodeClient) got, err := CreateNodeBalancer(context.Background(), testcase.clusterScope, logr.Discard()) if testcase.expectedError != nil { @@ -194,7 +194,7 @@ func TestCreateNodeBalancerConfig(t *testing.T) { clusterScope *scope.ClusterScope expectedConfig *linodego.NodeBalancerConfig expectedError error - expects func(m *mock.MockMachineScopeLinodeClient) + expects func(m *mock.MockMachineLinodeClient) }{ { name: "Success - Create NodeBalancerConfig using default LB port", @@ -220,7 +220,7 @@ func TestCreateNodeBalancerConfig(t *testing.T) { NodeBalancerID: 1234, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().CreateNodeBalancerConfig(gomock.Any(), gomock.Any(), gomock.Any()).Return(&linodego.NodeBalancerConfig{ Port: defaultLBPort, Protocol: linodego.ProtocolTCP, @@ -255,7 +255,7 @@ func TestCreateNodeBalancerConfig(t *testing.T) { NodeBalancerID: 1234, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().CreateNodeBalancerConfig(gomock.Any(), gomock.Any(), gomock.Any()).Return(&linodego.NodeBalancerConfig{ Port: 80, Protocol: linodego.ProtocolTCP, @@ -289,7 +289,7 @@ func TestCreateNodeBalancerConfig(t *testing.T) { NodeBalancerID: 1234, }, expectedError: fmt.Errorf("error creating NodeBalancerConfig"), - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().CreateNodeBalancerConfig(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error creating NodeBalancerConfig")) }, }, @@ -302,11 +302,11 @@ func TestCreateNodeBalancerConfig(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - MockMachineScopeLinodeClient := mock.NewMockMachineScopeLinodeClient(ctrl) + MockMachineLinodeClient := mock.NewMockMachineLinodeClient(ctrl) - testcase.clusterScope.LinodeClient = MockMachineScopeLinodeClient + testcase.clusterScope.LinodeClient = MockMachineLinodeClient - testcase.expects(MockMachineScopeLinodeClient) + testcase.expects(MockMachineLinodeClient) got, err := CreateNodeBalancerConfig(context.Background(), testcase.clusterScope, logr.Discard()) if testcase.expectedError != nil { @@ -326,60 +326,8 @@ func TestAddNodeToNBConditions(t *testing.T) { name string machineScope *scope.MachineScope expectedError error - expects func(mock *mock.MockMachineScopeLinodeClient) + expects func(mock *mock.MockMachineLinodeClient) }{ - { - name: "Error - NodeBalancerID is not set on the LinodeCluster", - machineScope: &scope.MachineScope{ - Machine: &clusterv1.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - Labels: map[string]string{ - clusterv1.MachineControlPlaneLabel: "true", - }, - }, - }, - Cluster: &clusterv1.Cluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - UID: "test-uid", - }, - }, - LinodeCluster: &infrav1alpha1.LinodeCluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - UID: "test-uid", - }, - Spec: infrav1alpha1.LinodeClusterSpec{ - Network: infrav1alpha1.NetworkSpec{ - NodeBalancerConfigID: ptr.To(5678), - }, - }, - }, - LinodeMachine: &infrav1alpha1.LinodeMachine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - }, - Spec: infrav1alpha1.LinodeMachineSpec{ - InstanceID: ptr.To(123), - }, - }, - }, - expectedError: fmt.Errorf("nil NodeBalancer ID"), - expects: func(m *mock.MockMachineScopeLinodeClient) { - m.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(&linodego.InstanceIPAddressResponse{ - IPv4: &linodego.InstanceIPv4Response{ - Private: []*linodego.InstanceIP{ - { - Address: "1.2.3.4", - }, - }, - }, - }, nil) - }, - }, { name: "Error - NodeBalancerConfigID are is set", machineScope: &scope.MachineScope{ @@ -416,7 +364,7 @@ func TestAddNodeToNBConditions(t *testing.T) { }, }, expectedError: fmt.Errorf("nil NodeBalancer Config ID"), - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(&linodego.InstanceIPAddressResponse{ IPv4: &linodego.InstanceIPv4Response{ Private: []*linodego.InstanceIP{ @@ -451,7 +399,7 @@ func TestAddNodeToNBConditions(t *testing.T) { }, }, expectedError: fmt.Errorf("no private IP address"), - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(&linodego.InstanceIPAddressResponse{ IPv4: &linodego.InstanceIPv4Response{ Private: []*linodego.InstanceIP{}, @@ -482,32 +430,10 @@ func TestAddNodeToNBConditions(t *testing.T) { }, }, expectedError: fmt.Errorf("could not get instance IP addresses"), - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("could not get instance IP addresses")) }, }, - { - name: "Error - no InstanceID was set in LinodeMachine Spec", - machineScope: &scope.MachineScope{ - Machine: &clusterv1.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - Labels: map[string]string{ - clusterv1.MachineControlPlaneLabel: "true", - }, - }, - }, - LinodeMachine: &infrav1alpha1.LinodeMachine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - }, - }, - }, - expectedError: fmt.Errorf("no InstanceID set for LinodeMachine.Spec"), - expects: func(m *mock.MockMachineScopeLinodeClient) {}, - }, } for _, tt := range tests { testcase := tt @@ -516,11 +442,11 @@ func TestAddNodeToNBConditions(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - MockMachineScopeLinodeClient := mock.NewMockMachineScopeLinodeClient(ctrl) + MockMachineLinodeClient := mock.NewMockMachineLinodeClient(ctrl) - testcase.machineScope.LinodeClient = MockMachineScopeLinodeClient + testcase.machineScope.LinodeClient = MockMachineLinodeClient - testcase.expects(MockMachineScopeLinodeClient) + testcase.expects(MockMachineLinodeClient) err := AddNodeToNB(context.Background(), logr.Discard(), testcase.machineScope) if testcase.expectedError != nil { @@ -537,7 +463,7 @@ func TestAddNodeToNBFullWorkflow(t *testing.T) { name string machineScope *scope.MachineScope expectedError error - expects func(mock *mock.MockMachineScopeLinodeClient) + expects func(mock *mock.MockMachineLinodeClient) }{ { name: "If the machine is not a control plane node, do nothing", @@ -556,7 +482,7 @@ func TestAddNodeToNBFullWorkflow(t *testing.T) { }, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) {}, + expects: func(m *mock.MockMachineLinodeClient) {}, }, { name: "Success - If the machine is a control plane node, add the node to the NodeBalancer", @@ -599,7 +525,7 @@ func TestAddNodeToNBFullWorkflow(t *testing.T) { }, }, expectedError: nil, - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(&linodego.InstanceIPAddressResponse{ IPv4: &linodego.InstanceIPv4Response{ Private: []*linodego.InstanceIP{ @@ -653,7 +579,7 @@ func TestAddNodeToNBFullWorkflow(t *testing.T) { }, }, expectedError: fmt.Errorf("could not create node balancer node"), - expects: func(mock *mock.MockMachineScopeLinodeClient) { + expects: func(mock *mock.MockMachineLinodeClient) { mock.EXPECT().GetInstanceIPAddresses(gomock.Any(), gomock.Any()).Return(&linodego.InstanceIPAddressResponse{ IPv4: &linodego.InstanceIPv4Response{ Private: []*linodego.InstanceIP{ @@ -674,11 +600,11 @@ func TestAddNodeToNBFullWorkflow(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - MockMachineScopeLinodeClient := mock.NewMockMachineScopeLinodeClient(ctrl) + MockMachineLinodeClient := mock.NewMockMachineLinodeClient(ctrl) - testcase.machineScope.LinodeClient = MockMachineScopeLinodeClient + testcase.machineScope.LinodeClient = MockMachineLinodeClient - testcase.expects(MockMachineScopeLinodeClient) + testcase.expects(MockMachineLinodeClient) err := AddNodeToNB(context.Background(), logr.Discard(), testcase.machineScope) if testcase.expectedError != nil { @@ -696,7 +622,7 @@ func TestDeleteNodeFromNB(t *testing.T) { machineScope *scope.MachineScope wantErr bool expectedError error - expects func(mock *mock.MockMachineScopeLinodeClient) + expects func(mock *mock.MockMachineLinodeClient) }{ // TODO: Add test cases. { @@ -716,29 +642,7 @@ func TestDeleteNodeFromNB(t *testing.T) { }, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) {}, - }, - { - name: "Error - If the machine is a control plane node, but no InstanceID is set, do nothing", - machineScope: &scope.MachineScope{ - Machine: &clusterv1.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - Labels: map[string]string{ - clusterv1.MachineControlPlaneLabel: "true", - }, - }, - }, - LinodeMachine: &infrav1alpha1.LinodeMachine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-machine", - UID: "test-uid", - }, - }, - }, - expectedError: fmt.Errorf("no InstanceID set for LinodeMachine.Spec"), - expects: func(m *mock.MockMachineScopeLinodeClient) {}, + expects: func(m *mock.MockMachineLinodeClient) {}, }, { name: "NodeBalancer is already deleted", @@ -772,7 +676,7 @@ func TestDeleteNodeFromNB(t *testing.T) { }, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) {}, + expects: func(m *mock.MockMachineLinodeClient) {}, }, { name: "Success - Delete Node from NodeBalancer", @@ -810,7 +714,7 @@ func TestDeleteNodeFromNB(t *testing.T) { }, }, expectedError: nil, - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().DeleteNodeBalancerNode(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil) }, }, @@ -850,7 +754,7 @@ func TestDeleteNodeFromNB(t *testing.T) { }, }, expectedError: fmt.Errorf("error deleting node from NodeBalancer"), - expects: func(m *mock.MockMachineScopeLinodeClient) { + expects: func(m *mock.MockMachineLinodeClient) { m.EXPECT().DeleteNodeBalancerNode(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(fmt.Errorf("error deleting node from NodeBalancer")) }, }, @@ -863,11 +767,11 @@ func TestDeleteNodeFromNB(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - MockMachineScopeLinodeClient := mock.NewMockMachineScopeLinodeClient(ctrl) + MockMachineLinodeClient := mock.NewMockMachineLinodeClient(ctrl) - testcase.machineScope.LinodeClient = MockMachineScopeLinodeClient + testcase.machineScope.LinodeClient = MockMachineLinodeClient - testcase.expects(MockMachineScopeLinodeClient) + testcase.expects(MockMachineLinodeClient) err := DeleteNodeFromNB(context.Background(), logr.Discard(), testcase.machineScope) if testcase.expectedError != nil { diff --git a/controller/linodeobjectstoragebucket_controller.go b/controller/linodeobjectstoragebucket_controller.go index 663047aa3..4679c1c8e 100644 --- a/controller/linodeobjectstoragebucket_controller.go +++ b/controller/linodeobjectstoragebucket_controller.go @@ -51,7 +51,7 @@ type LinodeObjectStorageBucketReconciler struct { Logger logr.Logger Recorder record.EventRecorder LinodeApiKey string - LinodeClientBuilder scope.LinodeObjectStorageBucketBuilder + LinodeClientBuilder scope.LinodeObjectStorageClientBuilder WatchFilterValue string ReconcileTimeout time.Duration } diff --git a/controller/linodeobjectstoragebucket_controller_test.go b/controller/linodeobjectstoragebucket_controller_test.go index ca750846d..c5b746af7 100644 --- a/controller/linodeobjectstoragebucket_controller_test.go +++ b/controller/linodeobjectstoragebucket_controller_test.go @@ -40,7 +40,7 @@ import ( . "github.com/onsi/gomega" ) -func mockClientBuilder(m *mock.MockLinodeObjectStorageClient) scope.LinodeObjectStorageBucketBuilder { +func mockClientBuilder(m *mock.MockLinodeObjectStorageClient) scope.LinodeObjectStorageClientBuilder { return func(_ string) (scope.LinodeObjectStorageClient, error) { return m, nil } diff --git a/mock/client.go b/mock/client.go index 2782362bd..2a781fb53 100644 --- a/mock/client.go +++ b/mock/client.go @@ -21,31 +21,31 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) -// MockMachineScopeLinodeClient is a mock of MachineScopeLinodeClient interface. -type MockMachineScopeLinodeClient struct { +// MockMachineLinodeClient is a mock of MachineLinodeClient interface. +type MockMachineLinodeClient struct { ctrl *gomock.Controller - recorder *MockMachineScopeLinodeClientMockRecorder + recorder *MockMachineLinodeClientMockRecorder } -// MockMachineScopeLinodeClientMockRecorder is the mock recorder for MockMachineScopeLinodeClient. -type MockMachineScopeLinodeClientMockRecorder struct { - mock *MockMachineScopeLinodeClient +// MockMachineLinodeClientMockRecorder is the mock recorder for MockMachineLinodeClient. +type MockMachineLinodeClientMockRecorder struct { + mock *MockMachineLinodeClient } -// NewMockMachineScopeLinodeClient creates a new mock instance. -func NewMockMachineScopeLinodeClient(ctrl *gomock.Controller) *MockMachineScopeLinodeClient { - mock := &MockMachineScopeLinodeClient{ctrl: ctrl} - mock.recorder = &MockMachineScopeLinodeClientMockRecorder{mock} +// NewMockMachineLinodeClient creates a new mock instance. +func NewMockMachineLinodeClient(ctrl *gomock.Controller) *MockMachineLinodeClient { + mock := &MockMachineLinodeClient{ctrl: ctrl} + mock.recorder = &MockMachineLinodeClientMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockMachineScopeLinodeClient) EXPECT() *MockMachineScopeLinodeClientMockRecorder { +func (m *MockMachineLinodeClient) EXPECT() *MockMachineLinodeClientMockRecorder { return m.recorder } // BootInstance mocks base method. -func (m *MockMachineScopeLinodeClient) BootInstance(ctx context.Context, linodeID, configID int) error { +func (m *MockMachineLinodeClient) BootInstance(ctx context.Context, linodeID, configID int) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "BootInstance", ctx, linodeID, configID) ret0, _ := ret[0].(error) @@ -53,13 +53,13 @@ func (m *MockMachineScopeLinodeClient) BootInstance(ctx context.Context, linodeI } // BootInstance indicates an expected call of BootInstance. -func (mr *MockMachineScopeLinodeClientMockRecorder) BootInstance(ctx, linodeID, configID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) BootInstance(ctx, linodeID, configID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BootInstance", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).BootInstance), ctx, linodeID, configID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BootInstance", reflect.TypeOf((*MockMachineLinodeClient)(nil).BootInstance), ctx, linodeID, configID) } // CreateInstance mocks base method. -func (m *MockMachineScopeLinodeClient) CreateInstance(ctx context.Context, opts linodego.InstanceCreateOptions) (*linodego.Instance, error) { +func (m *MockMachineLinodeClient) CreateInstance(ctx context.Context, opts linodego.InstanceCreateOptions) (*linodego.Instance, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateInstance", ctx, opts) ret0, _ := ret[0].(*linodego.Instance) @@ -68,13 +68,13 @@ func (m *MockMachineScopeLinodeClient) CreateInstance(ctx context.Context, opts } // CreateInstance indicates an expected call of CreateInstance. -func (mr *MockMachineScopeLinodeClientMockRecorder) CreateInstance(ctx, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) CreateInstance(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstance", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).CreateInstance), ctx, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstance", reflect.TypeOf((*MockMachineLinodeClient)(nil).CreateInstance), ctx, opts) } // CreateInstanceDisk mocks base method. -func (m *MockMachineScopeLinodeClient) CreateInstanceDisk(ctx context.Context, linodeID int, opts linodego.InstanceDiskCreateOptions) (*linodego.InstanceDisk, error) { +func (m *MockMachineLinodeClient) CreateInstanceDisk(ctx context.Context, linodeID int, opts linodego.InstanceDiskCreateOptions) (*linodego.InstanceDisk, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateInstanceDisk", ctx, linodeID, opts) ret0, _ := ret[0].(*linodego.InstanceDisk) @@ -83,13 +83,13 @@ func (m *MockMachineScopeLinodeClient) CreateInstanceDisk(ctx context.Context, l } // CreateInstanceDisk indicates an expected call of CreateInstanceDisk. -func (mr *MockMachineScopeLinodeClientMockRecorder) CreateInstanceDisk(ctx, linodeID, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) CreateInstanceDisk(ctx, linodeID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstanceDisk", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).CreateInstanceDisk), ctx, linodeID, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstanceDisk", reflect.TypeOf((*MockMachineLinodeClient)(nil).CreateInstanceDisk), ctx, linodeID, opts) } // CreateNodeBalancer mocks base method. -func (m *MockMachineScopeLinodeClient) CreateNodeBalancer(ctx context.Context, opts linodego.NodeBalancerCreateOptions) (*linodego.NodeBalancer, error) { +func (m *MockMachineLinodeClient) CreateNodeBalancer(ctx context.Context, opts linodego.NodeBalancerCreateOptions) (*linodego.NodeBalancer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateNodeBalancer", ctx, opts) ret0, _ := ret[0].(*linodego.NodeBalancer) @@ -98,13 +98,13 @@ func (m *MockMachineScopeLinodeClient) CreateNodeBalancer(ctx context.Context, o } // CreateNodeBalancer indicates an expected call of CreateNodeBalancer. -func (mr *MockMachineScopeLinodeClientMockRecorder) CreateNodeBalancer(ctx, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) CreateNodeBalancer(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancer", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).CreateNodeBalancer), ctx, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancer", reflect.TypeOf((*MockMachineLinodeClient)(nil).CreateNodeBalancer), ctx, opts) } // CreateNodeBalancerConfig mocks base method. -func (m *MockMachineScopeLinodeClient) CreateNodeBalancerConfig(ctx context.Context, nodebalancerID int, opts linodego.NodeBalancerConfigCreateOptions) (*linodego.NodeBalancerConfig, error) { +func (m *MockMachineLinodeClient) CreateNodeBalancerConfig(ctx context.Context, nodebalancerID int, opts linodego.NodeBalancerConfigCreateOptions) (*linodego.NodeBalancerConfig, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateNodeBalancerConfig", ctx, nodebalancerID, opts) ret0, _ := ret[0].(*linodego.NodeBalancerConfig) @@ -113,13 +113,13 @@ func (m *MockMachineScopeLinodeClient) CreateNodeBalancerConfig(ctx context.Cont } // CreateNodeBalancerConfig indicates an expected call of CreateNodeBalancerConfig. -func (mr *MockMachineScopeLinodeClientMockRecorder) CreateNodeBalancerConfig(ctx, nodebalancerID, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) CreateNodeBalancerConfig(ctx, nodebalancerID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancerConfig", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).CreateNodeBalancerConfig), ctx, nodebalancerID, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancerConfig", reflect.TypeOf((*MockMachineLinodeClient)(nil).CreateNodeBalancerConfig), ctx, nodebalancerID, opts) } // CreateNodeBalancerNode mocks base method. -func (m *MockMachineScopeLinodeClient) CreateNodeBalancerNode(ctx context.Context, nodebalancerID, configID int, opts linodego.NodeBalancerNodeCreateOptions) (*linodego.NodeBalancerNode, error) { +func (m *MockMachineLinodeClient) CreateNodeBalancerNode(ctx context.Context, nodebalancerID, configID int, opts linodego.NodeBalancerNodeCreateOptions) (*linodego.NodeBalancerNode, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateNodeBalancerNode", ctx, nodebalancerID, configID, opts) ret0, _ := ret[0].(*linodego.NodeBalancerNode) @@ -128,13 +128,13 @@ func (m *MockMachineScopeLinodeClient) CreateNodeBalancerNode(ctx context.Contex } // CreateNodeBalancerNode indicates an expected call of CreateNodeBalancerNode. -func (mr *MockMachineScopeLinodeClientMockRecorder) CreateNodeBalancerNode(ctx, nodebalancerID, configID, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) CreateNodeBalancerNode(ctx, nodebalancerID, configID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancerNode", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).CreateNodeBalancerNode), ctx, nodebalancerID, configID, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNodeBalancerNode", reflect.TypeOf((*MockMachineLinodeClient)(nil).CreateNodeBalancerNode), ctx, nodebalancerID, configID, opts) } // DeleteInstance mocks base method. -func (m *MockMachineScopeLinodeClient) DeleteInstance(ctx context.Context, linodeID int) error { +func (m *MockMachineLinodeClient) DeleteInstance(ctx context.Context, linodeID int) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteInstance", ctx, linodeID) ret0, _ := ret[0].(error) @@ -142,13 +142,13 @@ func (m *MockMachineScopeLinodeClient) DeleteInstance(ctx context.Context, linod } // DeleteInstance indicates an expected call of DeleteInstance. -func (mr *MockMachineScopeLinodeClientMockRecorder) DeleteInstance(ctx, linodeID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) DeleteInstance(ctx, linodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInstance", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).DeleteInstance), ctx, linodeID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInstance", reflect.TypeOf((*MockMachineLinodeClient)(nil).DeleteInstance), ctx, linodeID) } // DeleteNodeBalancer mocks base method. -func (m *MockMachineScopeLinodeClient) DeleteNodeBalancer(ctx context.Context, nodebalancerID int) error { +func (m *MockMachineLinodeClient) DeleteNodeBalancer(ctx context.Context, nodebalancerID int) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteNodeBalancer", ctx, nodebalancerID) ret0, _ := ret[0].(error) @@ -156,13 +156,13 @@ func (m *MockMachineScopeLinodeClient) DeleteNodeBalancer(ctx context.Context, n } // DeleteNodeBalancer indicates an expected call of DeleteNodeBalancer. -func (mr *MockMachineScopeLinodeClientMockRecorder) DeleteNodeBalancer(ctx, nodebalancerID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) DeleteNodeBalancer(ctx, nodebalancerID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteNodeBalancer", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).DeleteNodeBalancer), ctx, nodebalancerID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteNodeBalancer", reflect.TypeOf((*MockMachineLinodeClient)(nil).DeleteNodeBalancer), ctx, nodebalancerID) } // DeleteNodeBalancerNode mocks base method. -func (m *MockMachineScopeLinodeClient) DeleteNodeBalancerNode(ctx context.Context, nodebalancerID, configID, nodeID int) error { +func (m *MockMachineLinodeClient) DeleteNodeBalancerNode(ctx context.Context, nodebalancerID, configID, nodeID int) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteNodeBalancerNode", ctx, nodebalancerID, configID, nodeID) ret0, _ := ret[0].(error) @@ -170,13 +170,13 @@ func (m *MockMachineScopeLinodeClient) DeleteNodeBalancerNode(ctx context.Contex } // DeleteNodeBalancerNode indicates an expected call of DeleteNodeBalancerNode. -func (mr *MockMachineScopeLinodeClientMockRecorder) DeleteNodeBalancerNode(ctx, nodebalancerID, configID, nodeID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) DeleteNodeBalancerNode(ctx, nodebalancerID, configID, nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteNodeBalancerNode", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).DeleteNodeBalancerNode), ctx, nodebalancerID, configID, nodeID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteNodeBalancerNode", reflect.TypeOf((*MockMachineLinodeClient)(nil).DeleteNodeBalancerNode), ctx, nodebalancerID, configID, nodeID) } // GetInstance mocks base method. -func (m *MockMachineScopeLinodeClient) GetInstance(ctx context.Context, linodeID int) (*linodego.Instance, error) { +func (m *MockMachineLinodeClient) GetInstance(ctx context.Context, linodeID int) (*linodego.Instance, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetInstance", ctx, linodeID) ret0, _ := ret[0].(*linodego.Instance) @@ -185,13 +185,13 @@ func (m *MockMachineScopeLinodeClient) GetInstance(ctx context.Context, linodeID } // GetInstance indicates an expected call of GetInstance. -func (mr *MockMachineScopeLinodeClientMockRecorder) GetInstance(ctx, linodeID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) GetInstance(ctx, linodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstance", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).GetInstance), ctx, linodeID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstance", reflect.TypeOf((*MockMachineLinodeClient)(nil).GetInstance), ctx, linodeID) } // GetInstanceDisk mocks base method. -func (m *MockMachineScopeLinodeClient) GetInstanceDisk(ctx context.Context, linodeID, diskID int) (*linodego.InstanceDisk, error) { +func (m *MockMachineLinodeClient) GetInstanceDisk(ctx context.Context, linodeID, diskID int) (*linodego.InstanceDisk, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetInstanceDisk", ctx, linodeID, diskID) ret0, _ := ret[0].(*linodego.InstanceDisk) @@ -200,13 +200,13 @@ func (m *MockMachineScopeLinodeClient) GetInstanceDisk(ctx context.Context, lino } // GetInstanceDisk indicates an expected call of GetInstanceDisk. -func (mr *MockMachineScopeLinodeClientMockRecorder) GetInstanceDisk(ctx, linodeID, diskID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) GetInstanceDisk(ctx, linodeID, diskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceDisk", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).GetInstanceDisk), ctx, linodeID, diskID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceDisk", reflect.TypeOf((*MockMachineLinodeClient)(nil).GetInstanceDisk), ctx, linodeID, diskID) } // GetInstanceIPAddresses mocks base method. -func (m *MockMachineScopeLinodeClient) GetInstanceIPAddresses(ctx context.Context, linodeID int) (*linodego.InstanceIPAddressResponse, error) { +func (m *MockMachineLinodeClient) GetInstanceIPAddresses(ctx context.Context, linodeID int) (*linodego.InstanceIPAddressResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetInstanceIPAddresses", ctx, linodeID) ret0, _ := ret[0].(*linodego.InstanceIPAddressResponse) @@ -215,13 +215,13 @@ func (m *MockMachineScopeLinodeClient) GetInstanceIPAddresses(ctx context.Contex } // GetInstanceIPAddresses indicates an expected call of GetInstanceIPAddresses. -func (mr *MockMachineScopeLinodeClientMockRecorder) GetInstanceIPAddresses(ctx, linodeID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) GetInstanceIPAddresses(ctx, linodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceIPAddresses", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).GetInstanceIPAddresses), ctx, linodeID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceIPAddresses", reflect.TypeOf((*MockMachineLinodeClient)(nil).GetInstanceIPAddresses), ctx, linodeID) } // GetVPC mocks base method. -func (m *MockMachineScopeLinodeClient) GetVPC(ctx context.Context, vpcID int) (*linodego.VPC, error) { +func (m *MockMachineLinodeClient) GetVPC(ctx context.Context, vpcID int) (*linodego.VPC, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetVPC", ctx, vpcID) ret0, _ := ret[0].(*linodego.VPC) @@ -230,13 +230,13 @@ func (m *MockMachineScopeLinodeClient) GetVPC(ctx context.Context, vpcID int) (* } // GetVPC indicates an expected call of GetVPC. -func (mr *MockMachineScopeLinodeClientMockRecorder) GetVPC(ctx, vpcID any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) GetVPC(ctx, vpcID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVPC", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).GetVPC), ctx, vpcID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVPC", reflect.TypeOf((*MockMachineLinodeClient)(nil).GetVPC), ctx, vpcID) } // ListInstanceConfigs mocks base method. -func (m *MockMachineScopeLinodeClient) ListInstanceConfigs(ctx context.Context, linodeID int, opts *linodego.ListOptions) ([]linodego.InstanceConfig, error) { +func (m *MockMachineLinodeClient) ListInstanceConfigs(ctx context.Context, linodeID int, opts *linodego.ListOptions) ([]linodego.InstanceConfig, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListInstanceConfigs", ctx, linodeID, opts) ret0, _ := ret[0].([]linodego.InstanceConfig) @@ -245,13 +245,13 @@ func (m *MockMachineScopeLinodeClient) ListInstanceConfigs(ctx context.Context, } // ListInstanceConfigs indicates an expected call of ListInstanceConfigs. -func (mr *MockMachineScopeLinodeClientMockRecorder) ListInstanceConfigs(ctx, linodeID, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) ListInstanceConfigs(ctx, linodeID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceConfigs", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).ListInstanceConfigs), ctx, linodeID, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceConfigs", reflect.TypeOf((*MockMachineLinodeClient)(nil).ListInstanceConfigs), ctx, linodeID, opts) } // ListInstances mocks base method. -func (m *MockMachineScopeLinodeClient) ListInstances(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Instance, error) { +func (m *MockMachineLinodeClient) ListInstances(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Instance, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListInstances", ctx, opts) ret0, _ := ret[0].([]linodego.Instance) @@ -260,13 +260,13 @@ func (m *MockMachineScopeLinodeClient) ListInstances(ctx context.Context, opts * } // ListInstances indicates an expected call of ListInstances. -func (mr *MockMachineScopeLinodeClientMockRecorder) ListInstances(ctx, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) ListInstances(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstances", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).ListInstances), ctx, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstances", reflect.TypeOf((*MockMachineLinodeClient)(nil).ListInstances), ctx, opts) } // ListNodeBalancers mocks base method. -func (m *MockMachineScopeLinodeClient) ListNodeBalancers(ctx context.Context, opts *linodego.ListOptions) ([]linodego.NodeBalancer, error) { +func (m *MockMachineLinodeClient) ListNodeBalancers(ctx context.Context, opts *linodego.ListOptions) ([]linodego.NodeBalancer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListNodeBalancers", ctx, opts) ret0, _ := ret[0].([]linodego.NodeBalancer) @@ -275,13 +275,13 @@ func (m *MockMachineScopeLinodeClient) ListNodeBalancers(ctx context.Context, op } // ListNodeBalancers indicates an expected call of ListNodeBalancers. -func (mr *MockMachineScopeLinodeClientMockRecorder) ListNodeBalancers(ctx, opts any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) ListNodeBalancers(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListNodeBalancers", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).ListNodeBalancers), ctx, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListNodeBalancers", reflect.TypeOf((*MockMachineLinodeClient)(nil).ListNodeBalancers), ctx, opts) } // ResizeInstanceDisk mocks base method. -func (m *MockMachineScopeLinodeClient) ResizeInstanceDisk(ctx context.Context, linodeID, diskID, size int) error { +func (m *MockMachineLinodeClient) ResizeInstanceDisk(ctx context.Context, linodeID, diskID, size int) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ResizeInstanceDisk", ctx, linodeID, diskID, size) ret0, _ := ret[0].(error) @@ -289,9 +289,9 @@ func (m *MockMachineScopeLinodeClient) ResizeInstanceDisk(ctx context.Context, l } // ResizeInstanceDisk indicates an expected call of ResizeInstanceDisk. -func (mr *MockMachineScopeLinodeClientMockRecorder) ResizeInstanceDisk(ctx, linodeID, diskID, size any) *gomock.Call { +func (mr *MockMachineLinodeClientMockRecorder) ResizeInstanceDisk(ctx, linodeID, diskID, size any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResizeInstanceDisk", reflect.TypeOf((*MockMachineScopeLinodeClient)(nil).ResizeInstanceDisk), ctx, linodeID, diskID, size) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResizeInstanceDisk", reflect.TypeOf((*MockMachineLinodeClient)(nil).ResizeInstanceDisk), ctx, linodeID, diskID, size) } // MockLinodeInstanceClient is a mock of LinodeInstanceClient interface.