Skip to content
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

reconcile AWS NLB attributes on service creation #95247

Merged
merged 1 commit into from Nov 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -189,6 +189,9 @@ func (c *Cloud) ensureLoadBalancerv2(namespacedName types.NamespacedName, loadBa
return nil, fmt.Errorf("error creating listener: %q", err)
}
}
if err := c.reconcileLBAttributes(aws.StringValue(loadBalancer.LoadBalancerArn), annotations); err != nil {
return nil, err
}
Comment on lines +192 to +194
Copy link
Contributor

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.

Copy link
Contributor Author

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.

} else {
// TODO: Sync internal vs non-internal

Expand Down