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

reconcile AWS NLB attributes on service creation #95247

merged 1 commit into from
Nov 7, 2020

Conversation

kishorj
Copy link
Contributor

@kishorj kishorj commented Oct 2, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
The NLB attributes are now reconciled immediately after creating the load balancer. Previously, the LB attributes related annotations were applied only during updates to the service object. This required a two step process to apply the attributes correctly.
Which issue(s) this PR fixes:

Fixes #81584
Fixes #82595

Special notes for your reviewer:
Tested on kops cluster by specifying the following annotations on a service, the load balancer type is 'nlb' -

service.beta.kubernetes.io/aws-load-balancer-type
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled
service.beta.kubernetes.io/aws-load-balancer-access-log-enabled
service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix

Test summary

  • The annotation values get applied as expected during service creation
  • If aws-load-balancer-access-log-enabled is set to false, the other bucket-name and bucket-prefix get ignored
  • If service is created without the LB attributes annotations, default values are configured
  • Modifying the annotations results in corresponding change to the LB attributes

Does this PR introduce a user-facing change?:

The AWS network load balancer attributes can now be specified during service creation

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 2, 2020
@k8s-ci-robot
Copy link
Contributor

@kishorj: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 2, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @kishorj. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/cloudprovider sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 2, 2020
@kishorj kishorj changed the title [WIP] reconcile AWS NLB attributes on service creation reconcile AWS NLB attributes on service creation Oct 2, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 2, 2020
@kishorj
Copy link
Contributor Author

kishorj commented Oct 2, 2020

/assign m00nf1sh

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 2, 2020
@Chili-Man
Copy link

We're running into #82595 (cross zone loadbalancing annotation on NLB ignored on creation); it would be great if this can get reviewed and merged; I'd be more then happy to help with getting movement on this @M00nF1sh

Comment on lines +192 to +194
if err := c.reconcileLBAttributes(aws.StringValue(loadBalancer.LoadBalancerArn), annotations); err != nil {
return nil, err
}
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.

Copy link
Contributor

@M00nF1sh M00nF1sh left a comment

Choose a reason for hiding this comment

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

/lgtm
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2020
@M00nF1sh
Copy link
Contributor

M00nF1sh commented Nov 6, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kishorj, M00nF1sh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aSapien
Copy link

aSapien commented Feb 24, 2021

Similar ticket in the external provider repo: kubernetes/cloud-provider-aws#180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cloudprovider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS: Network Load Balancer ignores annotations upon creation AWS NLB: support for access log annotations
6 participants