Skip to content

Commit

Permalink
adds linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lubedacht committed Jan 11, 2024
1 parent f5b6462 commit 274c3c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/controller/ionoscloudmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import (
"context"
"errors"
"fmt"
"time"

Check failure on line 23 in internal/controller/ionoscloudmachine_controller.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
"github.com/ionos-cloud/cluster-api-provider-ionoscloud/internal/service/cloud"

"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"time"

"github.com/go-logr/logr"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down
7 changes: 7 additions & 0 deletions scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"

"k8s.io/client-go/util/retry"
"sigs.k8s.io/cluster-api/util/conditions"

Expand Down Expand Up @@ -91,11 +92,14 @@ func NewMachineScope(params MachineScopeParams) (*MachineScope, error) {
}, nil
}

// HasFailed Checks if the IonosCloudMachine is in a failed state.
func (m *MachineScope) HasFailed() bool {
status := m.IonosCloudMachine.Status
return status.FailureReason != nil || status.FailureMessage != nil
}

// PatchObject will apply all changes from the IonosCloudMachine.
// It will also make sure to patch the status subresource.
func (m *MachineScope) PatchObject() error {
conditions.SetSummary(m.IonosCloudMachine,
conditions.WithConditions(
Expand All @@ -110,6 +114,9 @@ func (m *MachineScope) PatchObject() error {
}})
}

// Finalize will make sure to apply a patch to the current IonosCloudMachine.
// It also implements a retry mechanism to increase the chance of success
// in case the patch operation was not successful.
func (m *MachineScope) Finalize() error {
// NOTE(lubedacht) retry is only a way to reduce the failure chance,
// but in general, the reconciliation logic must be resilient
Expand Down

0 comments on commit 274c3c4

Please sign in to comment.