aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

Add "AvailabilityZone:all" parameter to IP targets when TargetGroup is outside of Controller's VPC

Open a2ush opened this issue 2 years ago • 4 comments

Issue

#2650

Description

Currently, when you deploy targetgroupbinding with ALB/NLB TargetGroup which is outside of Loadbalancer Controller's VPC, the Controller cannot do RegisterTargets API because it doesn't add "AvailabilityZone:all" parameter to IP targets.

[Loadbalancer Controller Log]

Ex)
{"level":"error","ts":1658843126.3276293,"logger":"controller-runtime.manager.controller.targetGroupBinding","msg":"Reconciler error","reconciler group":"elbv2.k8s.aws","reconciler kind":"TargetGroupBinding","name":"my-tgb","namespace":"default","error":"ValidationError: The Availability Zone is required for IP address '192.168.28.187' because it is not in the VPC\n\tstatus code: 400, request id: b228b6b8-..."}

https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetDescription.html

If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

This PR helps Loadbalancer Controller to add "AvailabilityZone:all" parameter to IP targets in this situation, by comparing TargetGroup's VPC with Loadbalancer Controller's VPC. That is, you will be able to register pod's IP address to other VPC's TargetGroups.

New Loadbalancer Controller's log

Ex)
{"level":"info","ts":1658812216.264621,"msg":"registering targets","arn":"arn:aws:elasticloadbalancing:<Region>:<AccountID>:targetgroup/my-tgb/1234567890","targets":[{"AvailabilityZone":"all","Id":"192.168.36.77","Port":80},{"AvailabilityZone":"all","Id":"192.168.43.133","Port":80},{"AvailabilityZone":"all","Id":"192.168.53.216","Port":80}]}
{"level":"info","ts":1658812216.5066864,"msg":"registered targets","arn":"arn:aws:elasticloadbalancing:<Region>:<AccountID>:targetgroup/my-tgb/1234567890"}

Checklist

  • [ ] Added tests that cover your change (if possible)
  • [ ] Added/modified documentation as required (such as the README.md, or the docs directory)
  • [X] Manually tested
  • [X] 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?! :exploding_head:

  • [ ] Backfilled missing tests for code in same general area :tada:
  • [ ] Refactored something and made the world a better place :star2:

a2ush avatar Jul 26 '22 14:07 a2ush

Welcome @a2ush!

It looks like this is your first PR to kubernetes-sigs/aws-load-balancer-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-load-balancer-controller has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Jul 26 '22 14:07 k8s-ci-robot

Hi @a2ush. 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 avatar Jul 26 '22 14:07 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: a2ush Once this PR has been reviewed and has the lgtm label, please assign kishorj for approval by writing /assign @kishorj in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Jul 26 '22 14:07 k8s-ci-robot

Any chance of getting anyone to look into this? I am having the exact same problems as stated in the issue

daghsentinel avatar Oct 11 '22 08:10 daghsentinel

I'm also running into this. I'd really appreciate someone reviewing and merging it.

tmehlinger avatar Nov 30 '22 23:11 tmehlinger

/ok-to-test

kishorj avatar Dec 02 '22 19:12 kishorj

@kishorj thanks for checking this out, much appreciated!

tmehlinger avatar Dec 02 '22 20:12 tmehlinger

Thanks for your work on this, any idea when this bug fix might get merged in? We're running into this also and can't use aws-load-balancer-controller until this gets resolved.

pescetto avatar Feb 01 '23 18:02 pescetto

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 02 '23 19:05 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jun 01 '23 19:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Jul 01 '23 19:07 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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 avatar Jul 01 '23 19:07 k8s-ci-robot