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.
This is just my $0.02 as a very infrequent contributor, but this code seems to be copy-pasted from here: https://github.com/kubernetes/kubernetes/pull/95247/files#diff-3847bd7a991eef9e3fc1c058562e9a7eac0dbfbcefb28d60c9ce03080eb4caffR371
I wonder if that code can be taken out of this greater if/else to reduce duplication. The only snag I see is this brief section that comes after where this was copy-pasted from: https://github.com/kubernetes/kubernetes/pull/95247/files#diff-3847bd7a991eef9e3fc1c058562e9a7eac0dbfbcefb28d60c9ce03080eb4caffR375-R388
However, I would think that running it regardless of the great if/else case would not be harmful... not sure what the core maintainers think about this.
Regardless, I think a comment is needed here. It seems unintuitive to have to do this on creation, so future generations will thank you for explaining it and not relying on git history.
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.
Thanks for the review and the comments. Your concerns on the maintainability are valid.
Since the ELBv2
CreateLoadBalancer
API doesn't support specifying the load balancer attributes, they need to be reconciled separately. Hence the reconcile call immediately after creation. I feel the if-else block is ripe for refactor.