Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/provider/aws/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (p *Provider) delete(cache *AWS) error {
// But we can also store it in status.Cluster properties
// Actually, let's check if we can get it from the environment status
if err := p.deleteNLBForCluster(clusterCache); err != nil {
p.log.Warning("Error deleting load balancer: %v", err)
return fmt.Errorf("failed to delete load balancer (resources may be leaked): %w", err)
}
Comment on lines 104 to 106
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning immediately on load balancer deletion failure stops the rest of the teardown (EC2 instances, security groups, VPC). This can leak more resources than just the NLB. Consider continuing with phases 1–3 and returning an aggregated error at the end (or track the NLB error and return it after other cleanup completes).

Copilot uses AI. Check for mistakes.
Comment on lines 104 to 106
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to propagate deleteNLBForCluster failures alters delete() control flow; there are existing tests in pkg/provider/aws (including delete_test.go), but no unit test asserting the new behavior (e.g., delete returns an error when NLB deletion fails, and/or that other cleanup phases still run). Please add coverage for this path to prevent regressions.

Copilot generated this review using guidance from repository custom instructions.
}
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/aws/nlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ func (p *Provider) deleteTargetGroup(cache *ClusterCache) error {
Targets: targets,
}
ctxDereg, cancelDereg := context.WithTimeout(context.Background(), elbv2APITimeout)
_, _ = p.elbv2.DeregisterTargets(ctxDereg, deregisterInput)
if _, err := p.elbv2.DeregisterTargets(ctxDereg, deregisterInput); err != nil {
p.log.Warning("Failed to deregister targets from %s: %v", cache.TargetGroupArn, err)
}
cancelDereg()
}
}
Expand Down
Loading