Skip to content

Commit

Permalink
linting fixes and compiler error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lubedacht committed Jan 15, 2024
1 parent ded89ce commit b9d5f76
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
14 changes: 1 addition & 13 deletions api/v1alpha1/ionoscloudmachine_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/cloud/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b9d5f76

Please sign in to comment.