-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix ELB cleanup failure due to resource name end with a hyphen #7029
Conversation
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.
Hi @0xlen , thanks for opening a PR for this issue! 🚀 Before approving I wanted to confirm that trimming the ending |
Fix the incorrect resource name as mentioned in the issue eksctl-io#7028 Refector the getting resource name logic from ELB hostname with unit test cases
8f67ee7
to
5bcf25a
Compare
@TiberiuGC Thanks for the review. I found a bug for my original proposed fix so pushed an update again. I am positive right now after refactoring that part and added few unit test cases [1] (Real ELB test [2]). But I am not very sure if my proposal meets the criteria. Please let me know if you have any feedback. [1] 5bcf25a#diff-581a28d52a0e2589ad7027966d2b578dfe8dce701181ce35e53c2d4b06f5b302 |
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.
Thank you @0xlen ! Left few questions/suggestions below.
4989bf8
to
b73c890
Compare
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.
Great stuff @0xlen , thank you! I have one nit/question below
pkg/elb/cleanup.go
Outdated
@@ -199,6 +199,24 @@ func getServiceLoadBalancer(ctx context.Context, ec2API awsapi.EC2, elbAPI Descr | |||
return &lb, nil | |||
} | |||
|
|||
func getIngressELBName(ctx context.Context, hosts []string) (string, error) { |
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.
We can remove ctx context.Context
from the params
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.
Agree, I removed the unused ctx
parameter.
if err != nil { | ||
logger.Debug("%s is ALB Ingress, but probably not provisioned or something other unexpected when getting ALB resource name, skip: %s", metadata.Name, err) | ||
return nil, nil | ||
} |
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.
Maybe we should error if the parsed name exceeds maximum of 32 characters
is returned? thoughts @cPu1 ?
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.
I was referring original general text as considering there can have cannot get the hostname
or parsed name exceeds maximum of 32 characters
. Would be interested to know what could be the proper error message and I am happy to revise that.
c141c66
to
05e32e4
Compare
@0xlen Thank you for iterating on this! LGTM. I'll let the eksctl experts have a say on this before we merge it. |
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.
LGTM 👍
…l-io#7029) * Fix ELB cleanup failure due to resource name end with a hyphen Fix the incorrect resource name as mentioned in the issue eksctl-io#7028 Refector the getting resource name logic from ELB hostname with unit test cases * Fix code review change for PR#7029
Initiate the bug fix thread to mitigate the ELB cleanup issue due to incorrect resource name. (Fixes #7028)
Description
The current ELB cleanup logic doesn't handle the case when the trimmed ELB hostname string is ending with hyphen (
-
). This can cause the eksctl throw the error when making DescribeLoadBalancers API calls due to incorrect resource format. The issue can be reproduced by using the testing file [1] with the following error:By fixing the resource name issue, the expected deletion can be successfully executed [2].
[1] https://gist.github.com/0xlen/d3bab9e46a8e797760e4731817543b28
[2] https://gist.github.com/0xlen/15cd7f43fca4cc8483e70ed7fc85bcb5
Checklist
README.md
, or theuserdocs
directory)area/nodegroup
) and kind (e.g.kind/improvement
)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯