Skip to content

Commit a992b1d

Browse files
committed
fix linting, deprecations, remove capierrors
1 parent 3150693 commit a992b1d

File tree

79 files changed

+319
-771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+319
-771
lines changed

api/v1beta1/awsmachine_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

2222
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23-
"sigs.k8s.io/cluster-api/errors"
2423
)
2524

2625
const (
@@ -231,7 +230,7 @@ type AWSMachineStatus struct {
231230
// can be added as events to the Machine object and/or logged in the
232231
// controller's output.
233232
// +optional
234-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
233+
FailureReason *string `json:"failureReason,omitempty"`
235234

236235
// FailureMessage will be set in the event that there is a terminal problem
237236
// reconciling the Machine and will contain a more verbose string suitable

api/v1beta1/zz_generated.conversion.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.

api/v1beta1/zz_generated.deepcopy.go

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

api/v1beta2/awscluster_webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func TestAWSClusterValidateCreate(t *testing.T) {
663663
}
664664
for _, tt := range tests {
665665
t.Run(tt.name, func(t *testing.T) {
666-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)()
666+
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)
667667

668668
cluster := tt.cluster.DeepCopy()
669669
cluster.ObjectMeta = metav1.ObjectMeta{

api/v1beta2/awsmachine_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

2222
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23-
"sigs.k8s.io/cluster-api/errors"
2423
)
2524

2625
const (
@@ -352,7 +351,7 @@ type AWSMachineStatus struct {
352351
// can be added as events to the Machine object and/or logged in the
353352
// controller's output.
354353
// +optional
355-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
354+
FailureReason *string `json:"failureReason,omitempty"`
356355

357356
// FailureMessage will be set in the event that there is a terminal problem
358357
// reconciling the Machine and will contain a more verbose string suitable

api/v1beta2/awsmachine_webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ func TestAWSMachineCreate(t *testing.T) {
439439
}
440440
for _, tt := range tests {
441441
t.Run(tt.name, func(t *testing.T) {
442-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)()
442+
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)
443443

444444
machine := tt.machine.DeepCopy()
445445
machine.ObjectMeta = metav1.ObjectMeta{

api/v1beta2/zz_generated.deepcopy.go

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

bootstrap/eks/controllers/eksconfig_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
294294
b := ctrl.NewControllerManagedBy(mgr).
295295
For(&eksbootstrapv1.EKSConfig{}).
296296
WithOptions(option).
297-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(logger.FromContext(ctx).GetLogger(), r.WatchFilterValue)).
297+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), logger.FromContext(ctx).GetLogger(), r.WatchFilterValue)).
298298
Watches(
299299
&clusterv1.Machine{},
300300
handler.EnqueueRequestsFromMapFunc(r.MachineToBootstrapMapFunc),
@@ -315,7 +315,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
315315
err = c.Watch(
316316
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
317317
handler.EnqueueRequestsFromMapFunc((r.ClusterToEKSConfigs)),
318-
predicates.ClusterUnpausedAndInfrastructureReady(logger.FromContext(ctx).GetLogger())),
318+
predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), logger.FromContext(ctx).GetLogger())),
319319
)
320320
if err != nil {
321321
return errors.Wrap(err, "failed adding watch for Clusters to controller manager")

cmd/clusterawsadm/cmd/ami/ami.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package ami
1919

2020
import (
2121
"github.com/spf13/cobra"
22+
"k8s.io/kubectl/pkg/util/templates"
2223

2324
cm "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/ami/common"
2425
ls "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/ami/list"
25-
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
2626
)
2727

2828
// RootCmd is the root of the `ami command`.
@@ -31,7 +31,7 @@ func RootCmd() *cobra.Command {
3131
Use: "ami [command]",
3232
Short: "AMI commands",
3333
Args: cobra.NoArgs,
34-
Long: cmd.LongDesc(`
34+
Long: templates.LongDesc(`
3535
All AMI related actions such as:
3636
# Copy AMIs based on Kubernetes version, OS etc from an AWS account where AMIs are stored
3737
to the current AWS account (use case: air-gapped deployments)

cmd/clusterawsadm/cmd/ami/common/copy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"os"
2222

2323
"github.com/spf13/cobra"
24+
"k8s.io/kubectl/pkg/util/templates"
2425

2526
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/ami"
2627
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
2728
cmdout "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/printers"
28-
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
2929
logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log"
3030
)
3131

@@ -34,11 +34,11 @@ func CopyAMICmd() *cobra.Command {
3434
newCmd := &cobra.Command{
3535
Use: "copy",
3636
Short: "Copy AMIs from an AWS account to the AWS account which credentials are provided",
37-
Long: cmd.LongDesc(`
37+
Long: templates.LongDesc(`
3838
Copy AMIs based on Kubernetes version, OS, region from an AWS account where AMIs are stored
3939
to the current AWS account (use case: air-gapped deployments)
4040
`),
41-
Example: cmd.Examples(`
41+
Example: templates.Examples(`
4242
# Copy AMI from the default AWS account where AMIs are stored.
4343
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
4444
clusterawsadm ami copy --kubernetes-version=v1.30.1 --os=ubuntu-22.04 --region=us-west-2

0 commit comments

Comments
 (0)