-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Allow TargetGroup endpoints outside the ELB VPC #1862
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
Allow TargetGroup endpoints outside the ELB VPC #1862
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @shoekstra! |
Hi @shoekstra. 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 Once the patch is verified, the new status will be reflected by the 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. |
Codecov Report
@@ Coverage Diff @@
## main #1862 +/- ##
==========================================
- Coverage 47.98% 47.88% -0.11%
==========================================
Files 110 110
Lines 6177 6190 +13
==========================================
Hits 2964 2964
- Misses 2938 2951 +13
Partials 275 275
Continue to review full report at Codecov.
|
👍 |
CLA has been signed 👍 |
/assign @M00nF1sh |
@shoekstra
|
Hey @M00nF1sh, thanks for the feedback! I understand both concerns...
|
Hi @shoekstra any change to fix the conflicts so that your fix can be merged? Cheers |
e39d354
to
e0aed65
Compare
Hi @M00nF1sh, I took inspiration from the AZ info interface and gave this another go by implementing the feature in a similar way. I think I've now satisfied the points in your previous feedback, please let me know. I was thinking to also set Thanks! |
e0aed65
to
62e9d67
Compare
62e9d67
to
c5c46fd
Compare
365ca4e
to
4b5d1a7
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: M00nF1sh, shoekstra 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 |
/lgtm |
Great to hear @M00nF1sh! All sounds good to me. Looking forward to switching back to the official image 👍 |
So happy this has shipped; I just tested using the official |
We use amazon/aws-alb-ingress-controller:v2.4.1 installed by helm(chart: aws-load-balancer-controller-1.4.1, app version: v2.4.1) Still can not Register pod to a TargetGroup(in another VPC), the controoler log: {"level":"error","ts":1653988309.5380044,"logger":"controller-runtime.manager.controller.targetGroupBinding","msg":"Reconciler error","reconciler group":"elbv2.k8s.aws","reconciler kind":"TargetGroupBinding","name":"tgb-cloud-appserverweb","namespace":"us-platform","error":"ValidationError: The Availability Zone for IP address '10.151.135.88' must be 'all' for Application Load Balancer target groups, when not within the VPC\n\tstatus code: 400, request id: 1b1b5648-be4e-45fb-89a0-e601bc232b0b"} |
@wuyudian1 you need to make sure that your targets are in zone "all" and not on a specific zone. |
The targets are my PODs, do you mean that I need to setup some configurations in the Deployment to change their AZ to be "all"? |
I dont know how to make it "all", hoping someone may help me |
My TargetGroupBinding definition: apiVersion: elbv2.k8s.aws/v1beta1
kind: TargetGroupBinding
metadata:
name: tgb-cloud-appserverweb
namespace: us-platform
spec:
serviceRef:
name: svc-clusterip-cloud-appserverweb
port: 8171
targetGroupARN: arn:aws:elasticloadbalancing:us-east-1:94...0:targetgroup/xxxxxx/93e...2b9
targetType: ip Contoller log:
We can see that LB Controller got "null" at AvailabilityZone, so, I'm wondering how to fix it |
|
@nuriel77 set the |
@shoekstra If there's more than one LB controller instance(with vpcID set to different values), how dose a TargetGroupBinding object(which trying to bind POD IPs to a specific TargetGroup in a specific VPC) choose the correct/proper contoller instance ? |
i am having this issue too, deployed the controller in another VPC (ingress vpc), the alb gets provision and the target groups gets created, but no registered target. Here is the log I get from the controller. any ideas? |
* Allow TargetGroup endpoints outside the ELB VPC To support the scenario where the ELB is deployed in a separate VPC to the EKS cluster, we need to conditionally set the `AvailabilityZone` field to `all` when the target is outside of the ELB VPC. This commit addresses this by checking if the pod IP is found in the ELB VPC's CIDR or a secondary CIDR; to improve performance and reduce calls to the AWS API, VPC info is cached for a configurable amount of time, defaulting to 5 minutes. Signed-off-by: Stephen Hoekstra <[email protected]> * Make isELBV2TargetInELBVPC more efficient Don't need to check vpc.CidrBlock as it is part of vpc.CidrBlockAssociationSet. isIPinCIDR is now also a bit more robust in checking if an IP is part of a CIDR. Signed-off-by: Stephen Hoekstra <[email protected]> * Add vpcID to defaultResourceManager We're already passing this into NewDefaultResourceManager so no need to also add it to NetworkingManager. Signed-off-by: Stephen Hoekstra <[email protected]> * Change VPC cache duration to 10m Also switched cache value to be time.Duration from int. Signed-off-by: Stephen Hoekstra <[email protected]> * Whoops, we should return an error if found... * Use apimachinery/pkg/util/cache for caching Signed-off-by: Stephen Hoekstra <[email protected]> * remove the aws-vpc-cache-ttl flag fix unit tests Co-authored-by: M00nF1sh <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1862 +/- ##
==========================================
- Coverage 54.19% 54.18% -0.02%
==========================================
Files 136 138 +2
Lines 7702 7757 +55
==========================================
+ Hits 4174 4203 +29
- Misses 3212 3234 +22
- Partials 316 320 +4 ☔ View full report in Codecov by Sentry. |
Closes #1569
To support the scenario where the ELB is deployed in a separate VPC to the EKS cluster, we need to conditionally set the
AvailabilityZone
field toall
when the target is outside the VPC as per the TargetDescription docs.This PR addresses this by checking if the pod IP is found in the ELB VPC's CIDR or a secondary CIDR; to improve performance and reduce calls to the AWS API, VPC info is cached for a configurable amount of time, defaulting to 5 minutes.
Signed-off-by: Stephen Hoekstra [email protected]