Skip to content

Commit d793491

Browse files
committed
Remove some use of deprecated errors package
1 parent 8fd1b70 commit d793491

19 files changed

+88
-101
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ CODESPELL_BIN := codespell
135135
CODESPELL_DIST_DIR := codespell_dist
136136
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)
137137

138-
# This is a commit from CR main (22.05.2024).
139-
# Intentionally using a commit from main to use a setup-envtest version
140-
# that uses binaries from controller-tools, not GCS.
141-
# CR PR: https://github.com/kubernetes-sigs/controller-runtime/pull/2811
142-
SETUP_ENVTEST_VER := v0.0.0-20240522175850-2e9781e9fc60
138+
SETUP_ENVTEST_VER := release-0.19
143139
SETUP_ENVTEST_BIN := setup-envtest
144140
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
145141
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest

api/v1beta1/azuremachine_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/api/resource"
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24-
"sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
2524
)
2625

2726
const (
@@ -219,7 +218,7 @@ type AzureMachineStatus struct {
219218
// can be added as events to the Machine object and/or logged in the
220219
// controller's output.
221220
// +optional
222-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
221+
FailureReason *string `json:"failureReason,omitempty"`
223222

224223
// ErrorMessage will be set in the event that there is a terminal problem
225224
// reconciling the Machine and will contain a more verbose string suitable

api/v1beta1/azuremanagedmachinepool_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package v1beta1
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22-
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
2322
)
2423

2524
const (
@@ -464,7 +463,7 @@ type AzureManagedMachinePoolStatus struct {
464463
// can be added as events to the Machine object and/or logged in the
465464
// controller's output.
466465
// +optional
467-
ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"`
466+
ErrorReason *string `json:"errorReason,omitempty"`
468467

469468
// Any transient errors that occur during the reconciliation of Machines
470469
// can be added as events to the Machine object and/or logged in the

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

azure/errors.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ const (
6262
TransientErrorType ReconcileErrorType = "Transient"
6363
// TerminalErrorType cannot be recovered, will not be requeued.
6464
TerminalErrorType ReconcileErrorType = "Terminal"
65+
// UnsupportedChange is returned when a change is not supported.
66+
UnsupportedChange = "UnsupportedChange"
67+
// InvalidConfiguration is returned when a configuration is invalid.
68+
InvalidConfiguration = "InvalidConfiguration"
69+
// CreateError is returned when an error occurs during creation.
70+
CreateError = "CreateError"
71+
// UpdateError is returned when an error occurs during update.
72+
UpdateError = "UpdateError"
6573
)
6674

6775
// Error returns the error message for a ReconcileError.

azure/scope/machine.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"k8s.io/apimachinery/pkg/types"
3030
"k8s.io/utils/ptr"
3131
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
32-
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
3332
"sigs.k8s.io/cluster-api/util"
3433
"sigs.k8s.io/cluster-api/util/conditions"
3534
"sigs.k8s.io/cluster-api/util/patch"
@@ -600,7 +599,7 @@ func (m *MachineScope) SetFailureMessage(v error) {
600599
}
601600

602601
// SetFailureReason sets the AzureMachine status failure reason.
603-
func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {
602+
func (m *MachineScope) SetFailureReason(v string) {
604603
m.AzureMachine.Status.FailureReason = &v
605604
}
606605

azure/scope/machinepool.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"k8s.io/klog/v2"
3434
"k8s.io/utils/ptr"
3535
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
36-
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
3736
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
3837
"sigs.k8s.io/cluster-api/util"
3938
"sigs.k8s.io/cluster-api/util/annotations"
@@ -648,7 +647,7 @@ func (m *MachinePoolScope) SetFailureMessage(v error) {
648647
}
649648

650649
// SetFailureReason sets the AzureMachinePool status failure reason.
651-
func (m *MachinePoolScope) SetFailureReason(v capierrors.MachineStatusError) {
650+
func (m *MachinePoolScope) SetFailureReason(v string) {
652651
m.AzureMachinePool.Status.FailureReason = &v
653652
}
654653

azure/scope/machinepoolmachine.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2929
"sigs.k8s.io/cluster-api/controllers/noderefutil"
3030
"sigs.k8s.io/cluster-api/controllers/remote"
31-
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
3231
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
3332
"sigs.k8s.io/cluster-api/util/conditions"
3433
"sigs.k8s.io/cluster-api/util/patch"
@@ -277,7 +276,7 @@ func (s *MachinePoolMachineScope) SetFailureMessage(v error) {
277276
}
278277

279278
// SetFailureReason sets the AzureMachinePoolMachine status failure reason.
280-
func (s *MachinePoolMachineScope) SetFailureReason(v capierrors.MachineStatusError) {
279+
func (s *MachinePoolMachineScope) SetFailureReason(v string) {
281280
s.AzureMachinePoolMachine.Status.FailureReason = &v
282281
}
283282

azure/services/aso/aso.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ func isOwnedBy(resource client.Object, owner client.Object, scheme *runtime.Sche
378378
}
379379

380380
func hasLegacyOwnedByLabel(labels map[string]string, clusterName string) bool {
381-
//nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
382-
return labels[infrav1.OwnedByClusterLabelKey] == clusterName
381+
return labels[infrav1.OwnedByClusterLabelKey] == clusterName //nolint:staticcheck
383382
}
384383

385384
// PauseResource pauses an ASO resource by updating its `reconcile-policy` to `skip`.

azure/services/aso/aso_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,8 @@ func TestCreateOrUpdateResource(t *testing.T) {
565565
Name: "name",
566566
Namespace: "namespace",
567567
Labels: map[string]string{
568-
clusterv1.ClusterNameLabel: clusterName,
569-
//nolint:staticcheck // Referencing this deprecated value is required for backwards compatibility.
570-
infrav1.OwnedByClusterLabelKey: clusterName,
568+
clusterv1.ClusterNameLabel: clusterName,
569+
infrav1.OwnedByClusterLabelKey: clusterName, //nolint:staticcheck
571570
},
572571
Annotations: map[string]string{
573572
asoannotations.ReconcilePolicy: string(asoannotations.ReconcilePolicySkip),

0 commit comments

Comments
 (0)