aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
Add "AvailabilityZone:all" parameter to IP targets when TargetGroup is outside of Controller's VPC
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 thedocs
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:
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:
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.
[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.
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
Any chance of getting anyone to look into this? I am having the exact same problems as stated in the issue
I'm also running into this. I'd really appreciate someone reviewing and merging it.
/ok-to-test
@kishorj thanks for checking this out, much appreciated!
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.
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
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
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: 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 closedYou 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.