-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Bump golangci-lint to v1.53.2 #4326
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package controllers | |
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"github.com/google/go-cmp/cmp/cmpopts" | ||
|
@@ -164,13 +165,13 @@ func (r *AWSMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |
switch infraScope := infraCluster.(type) { | ||
case *scope.ManagedControlPlaneScope: | ||
if !awsMachinePool.ObjectMeta.DeletionTimestamp.IsZero() { | ||
return r.reconcileDelete(machinePoolScope, infraScope, infraScope) | ||
return ctrl.Result{}, r.reconcileDelete(machinePoolScope, infraScope, infraScope) | ||
} | ||
|
||
return r.reconcileNormal(ctx, machinePoolScope, infraScope, infraScope) | ||
case *scope.ClusterScope: | ||
if !awsMachinePool.ObjectMeta.DeletionTimestamp.IsZero() { | ||
return r.reconcileDelete(machinePoolScope, infraScope, infraScope) | ||
return ctrl.Result{}, r.reconcileDelete(machinePoolScope, infraScope, infraScope) | ||
} | ||
|
||
return r.reconcileNormal(ctx, machinePoolScope, infraScope, infraScope) | ||
|
@@ -214,14 +215,14 @@ func (r *AWSMachinePoolReconciler) reconcileNormal(ctx context.Context, machineP | |
if !machinePoolScope.Cluster.Status.InfrastructureReady { | ||
machinePoolScope.Info("Cluster infrastructure is not ready yet") | ||
conditions.MarkFalse(machinePoolScope.AWSMachinePool, expinfrav1.ASGReadyCondition, infrav1.WaitingForClusterInfrastructureReason, clusterv1.ConditionSeverityInfo, "") | ||
return ctrl.Result{}, nil | ||
return ctrl.Result{Requeue: true}, nil | ||
} | ||
|
||
// Make sure bootstrap data is available and populated | ||
if machinePoolScope.MachinePool.Spec.Template.Spec.Bootstrap.DataSecretName == nil { | ||
machinePoolScope.Info("Bootstrap data secret reference is not yet available") | ||
conditions.MarkFalse(machinePoolScope.AWSMachinePool, expinfrav1.ASGReadyCondition, infrav1.WaitingForBootstrapDataReason, clusterv1.ConditionSeverityInfo, "") | ||
return ctrl.Result{}, nil | ||
return ctrl.Result{RequeueAfter: time.Minute}, nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
ec2Svc := r.getEC2Service(ec2Scope) | ||
|
@@ -334,15 +335,15 @@ func (r *AWSMachinePoolReconciler) reconcileNormal(ctx context.Context, machineP | |
return ctrl.Result{}, nil | ||
} | ||
|
||
func (r *AWSMachinePoolReconciler) reconcileDelete(machinePoolScope *scope.MachinePoolScope, clusterScope cloud.ClusterScoper, ec2Scope scope.EC2Scope) (ctrl.Result, error) { | ||
func (r *AWSMachinePoolReconciler) reconcileDelete(machinePoolScope *scope.MachinePoolScope, clusterScope cloud.ClusterScoper, ec2Scope scope.EC2Scope) error { | ||
clusterScope.Info("Handling deleted AWSMachinePool") | ||
|
||
ec2Svc := r.getEC2Service(ec2Scope) | ||
asgSvc := r.getASGService(clusterScope) | ||
|
||
asg, err := r.findASG(machinePoolScope, asgSvc) | ||
if err != nil { | ||
return ctrl.Result{}, err | ||
return err | ||
} | ||
|
||
if asg == nil { | ||
|
@@ -361,36 +362,36 @@ func (r *AWSMachinePoolReconciler) reconcileDelete(machinePoolScope *scope.Machi | |
machinePoolScope.Info("Deleting ASG", "id", asg.Name, "status", asg.Status) | ||
if err := asgSvc.DeleteASGAndWait(asg.Name); err != nil { | ||
r.Recorder.Eventf(machinePoolScope.AWSMachinePool, corev1.EventTypeWarning, "FailedDelete", "Failed to delete ASG %q: %v", asg.Name, err) | ||
return ctrl.Result{}, errors.Wrap(err, "failed to delete ASG") | ||
return errors.Wrap(err, "failed to delete ASG") | ||
} | ||
} | ||
} | ||
|
||
launchTemplateID := machinePoolScope.AWSMachinePool.Status.LaunchTemplateID | ||
launchTemplate, _, err := ec2Svc.GetLaunchTemplate(machinePoolScope.LaunchTemplateName()) | ||
if err != nil { | ||
return ctrl.Result{}, err | ||
return err | ||
} | ||
|
||
if launchTemplate == nil { | ||
machinePoolScope.Debug("Unable to locate launch template") | ||
r.Recorder.Eventf(machinePoolScope.AWSMachinePool, corev1.EventTypeNormal, "NoASGFound", "Unable to find matching ASG") | ||
controllerutil.RemoveFinalizer(machinePoolScope.AWSMachinePool, expinfrav1.MachinePoolFinalizer) | ||
return ctrl.Result{}, nil | ||
return nil | ||
} | ||
|
||
machinePoolScope.Info("deleting launch template", "name", launchTemplate.Name) | ||
if err := ec2Svc.DeleteLaunchTemplate(launchTemplateID); err != nil { | ||
r.Recorder.Eventf(machinePoolScope.AWSMachinePool, corev1.EventTypeWarning, "FailedDelete", "Failed to delete launch template %q: %v", launchTemplate.Name, err) | ||
return ctrl.Result{}, errors.Wrap(err, "failed to delete ASG") | ||
return errors.Wrap(err, "failed to delete ASG") | ||
} | ||
|
||
machinePoolScope.Info("successfully deleted AutoScalingGroup and Launch Template") | ||
|
||
// remove finalizer | ||
controllerutil.RemoveFinalizer(machinePoolScope.AWSMachinePool, expinfrav1.MachinePoolFinalizer) | ||
|
||
return ctrl.Result{}, nil | ||
return nil | ||
} | ||
|
||
func (r *AWSMachinePoolReconciler) updatePool(machinePoolScope *scope.MachinePoolScope, clusterScope cloud.ClusterScoper, existingASG *expinfrav1.AutoScalingGroup) error { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this returning true now? that would active the rate limiter, wouldn't this be just requeue when a change in the status triggers and event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done it based on discussion here: #4321 (comment)