From b9d5f76a84048112994fc8b135cba021e26cb058 Mon Sep 17 00:00:00 2001 From: Ludwig Bedacht Date: Mon, 15 Jan 2024 09:50:56 +0100 Subject: [PATCH] linting fixes and compiler error fix --- api/v1alpha1/ionoscloudmachine_types_test.go | 14 +------------- api/v1alpha1/suite_test.go | 2 +- internal/service/cloud/network.go | 6 +++--- scope/machine.go | 4 +++- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/api/v1alpha1/ionoscloudmachine_types_test.go b/api/v1alpha1/ionoscloudmachine_types_test.go index 585daa41..c5e2cf68 100644 --- a/api/v1alpha1/ionoscloudmachine_types_test.go +++ b/api/v1alpha1/ionoscloudmachine_types_test.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" - "net/http" + "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -68,18 +68,6 @@ func completeMachine() *IonosCloudMachine { } } -func completeStatus() *IonosCloudMachineStatus { - return &IonosCloudMachineStatus{ - Ready: false, - CurrentRequest: &ProvisioningRequest{ - Method: http.MethodPost, - RequestPath: "requestPath", - State: RequestStatusRunning, - Message: ptr.To("requestMessage"), - }, - } -} - var _ = Describe("IonosCloudMachine Tests", func() { AfterEach(func() { err := k8sClient.Delete(context.Background(), defaultMachine()) diff --git a/api/v1alpha1/suite_test.go b/api/v1alpha1/suite_test.go index c12d4014..77ce231a 100644 --- a/api/v1alpha1/suite_test.go +++ b/api/v1alpha1/suite_test.go @@ -48,7 +48,7 @@ var _ = BeforeSuite(func() { filepath.Join("..", "..", "config", "crd", "bases"), }, // NOTE(gfariasalves): To be removed after I finish the PR comments - //BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", "1.28.0-linux-amd64"), + // BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", "1.28.0-linux-amd64"), ErrorIfCRDPathMissing: true, } diff --git a/internal/service/cloud/network.go b/internal/service/cloud/network.go index 182a2efe..4d26c314 100644 --- a/internal/service/cloud/network.go +++ b/internal/service/cloud/network.go @@ -166,7 +166,7 @@ func (s *Service) createLAN() error { return fmt.Errorf("unable to create LAN in data center %s: %w", s.DataCenterID(), err) } - s.scope.ClusterScope.IonosCluster.Status.PendingRequests[s.DataCenterID()] = infrav1.ProvisioningRequest{ + s.scope.ClusterScope.IonosCluster.Status.CurrentRequest[s.DataCenterID()] = infrav1.ProvisioningRequest{ Method: http.MethodPost, RequestPath: requestPath, State: infrav1.RequestStatusQueued, @@ -190,7 +190,7 @@ func (s *Service) deleteLAN(lanID string) error { return fmt.Errorf("unable to request LAN deletion in data center: %w", err) } - s.scope.ClusterScope.IonosCluster.Status.PendingRequests[s.DataCenterID()] = infrav1.ProvisioningRequest{ + s.scope.ClusterScope.IonosCluster.Status.CurrentRequest[s.DataCenterID()] = infrav1.ProvisioningRequest{ Method: http.MethodDelete, RequestPath: requestPath, State: infrav1.RequestStatusQueued, @@ -258,7 +258,7 @@ func (s *Service) checkForPendingLANRequest(method string, lanID string) (status } func (s *Service) removeLANPendingRequestFromCluster() error { - delete(s.scope.ClusterScope.IonosCluster.Status.PendingRequests, s.DataCenterID()) + delete(s.scope.ClusterScope.IonosCluster.Status.CurrentRequest, s.DataCenterID()) if err := s.scope.ClusterScope.PatchObject(); err != nil { return fmt.Errorf("could not remove stale LAN pending request from cluster: %w", err) } diff --git a/scope/machine.go b/scope/machine.go index fbe93c95..939a50cf 100644 --- a/scope/machine.go +++ b/scope/machine.go @@ -20,16 +20,18 @@ import ( "context" "errors" "fmt" + ctrl "sigs.k8s.io/controller-runtime" "k8s.io/client-go/util/retry" "sigs.k8s.io/cluster-api/util/conditions" "github.com/go-logr/logr" - infrav1 "github.com/ionos-cloud/cluster-api-provider-ionoscloud/api/v1alpha1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" + + infrav1 "github.com/ionos-cloud/cluster-api-provider-ionoscloud/api/v1alpha1" ) // MachineScope defines a basic context for primary use in IonosCloudMachineReconciler.