Skip to content

Add support to disable cluster tag check during subnet auto-discovery #2635

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

Merged
merged 4 commits into from
May 11, 2022

Conversation

oliviassss
Copy link
Collaborator

@oliviassss oliviassss commented May 2, 2022

Issue

Description

Add a feature gate SubnetsClusterTagCheck to enable/disable the check for cluster tag kubernetes.io/cluster/${cluster-name} during subnet auto-discovery, with default value to true. When set to false, the subnets do not have to be tagged for current cluster.
This flag is to solve the user case that for EKS 1.19 and later versions, EKS stops adding the cluster tag kubernetes.io/cluster/{cluster-name} to subnets. For customer reusing the subnets for new 1.19 and later versions, the subnets will not be tagged for new clusters, so the subnets gets ignored during auto-discovery. In this case they can disable the cluster tag check so they do not need to tag the subnets for current cluster manually.

Tests

  • Add unit tests to cover the change
  • With SubnetsClusterTagCheck=true, created ALB and NLB with 2 subnets in the same AZ (1 tagged for current cluster, 1 tagged for other cluster), verified that the subnet tagged for current cluster got precedence.
  • With SubnetsClusterTagCheck=false, created ALB and NLB with 2 subnets (both tagged for other clusters), verified the subnet got discovered by the order of subnet_id.
  • With SubnetsClusterTagCheck=false, created ALB and NLB with 2 subnets (both contained no cluster tag at all), verified the subnet got discovered by the order of subnet_id.
  • With SubnetsClusterTagCheck=false, created ALB and NLB with 2 subnets (1 tagged for current cluster, 1 tagged for other cluster), verified the subnet tagged for current cluster still got precedence.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 2, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @oliviassss. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 2, 2022
@k8s-ci-robot k8s-ci-robot requested review from kishorj and M00nF1sh May 2, 2022 17:29
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 2, 2022
Copy link
Collaborator

@kishorj kishorj left a comment

Choose a reason for hiding this comment

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

Need to so similar for NLB as well.

And some nit comments

@kishorj kishorj added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 2, 2022
@oliviassss oliviassss requested a review from kishorj May 3, 2022 20:47
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2022

Codecov Report

Merging #2635 (ee664e5) into main (cb4f483) will increase coverage by 0.03%.
The diff coverage is 76.92%.

@@            Coverage Diff             @@
##             main    #2635      +/-   ##
==========================================
+ Coverage   53.96%   53.99%   +0.03%     
==========================================
  Files         144      144              
  Lines        8202     8214      +12     
==========================================
+ Hits         4426     4435       +9     
- Misses       3458     3461       +3     
  Partials      318      318              
Impacted Files Coverage Δ
pkg/config/feature_gates.go 0.00% <0.00%> (ø)
pkg/ingress/model_builder.go 64.21% <50.00%> (-0.15%) ⬇️
pkg/service/model_build_load_balancer.go 82.27% <50.00%> (-0.30%) ⬇️
pkg/ingress/model_build_load_balancer.go 63.95% <100.00%> (+0.14%) ⬆️
pkg/networking/subnet_resolver.go 92.77% <100.00%> (+0.16%) ⬆️
pkg/service/model_builder.go 88.04% <100.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb4f483...ee664e5. Read the comment docs.

@kishorj
Copy link
Collaborator

kishorj commented May 7, 2022

/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. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 7, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 11, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 11, 2022
@kishorj
Copy link
Collaborator

kishorj commented May 11, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit 0ad294b into kubernetes-sigs:main May 11, 2022
@oliviassss oliviassss deleted the add-feature-flag branch May 11, 2022 18:47
Timothy-Dougherty pushed a commit to adammw/aws-load-balancer-controller that referenced this pull request Nov 9, 2023
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants