-
Notifications
You must be signed in to change notification settings - Fork 1.5k
TargetGroupBindings can now manipulate target groups from different aws accounts #3691
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
TargetGroupBindings can now manipulate target groups from different aws accounts #3691
Conversation
Hi @marcosdiez. 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-sigs/prow repository. |
@shraddhabang I believe my code is ready. Feel free to review at will! Thank you. Also, if you don't want the CRDs to be changed, here: they are untouched. |
Thank you @marcosdiez for this PR. This looks excellent. |
/ok-to-test |
70267e1
to
bb3c617
Compare
7b5b35f
to
85bbf7f
Compare
Hi @shraddhabang ,
Could you please share us when the v2.9.0 would release? We are looking forward to this feature. |
Hi, @johngmyers @M00nF1sh @shraddhabang
Does anyone know the release schedule for v2.9.0 ? |
85bbf7f
to
6025b73
Compare
I just rebased and merged my code. There is also a container available here: |
Waited for this for a very long time! We need this ASAP. |
I'm waiting for this feature long time ago. Please approve and merge asap. |
I've been eagerly awaiting this feature for a long time. Please approve and merge it as soon as possible. This feature is crucial for the efficient delivery of my infrastructure, as it will significantly enhance our operational capabilities. |
I need this feature! please approve it. |
Looking forward for this to be merged! 🚀 |
This is precisely what I was looking for. Is there an estimate for when this will be merged? I don't want to fork the repo just for this. |
Hello, thank you for this contribution. I apologize that we've made you wait so long for a proper review. I took a look at the code and it looks really good to me aside from small code duplication in the register targets path; but we can refactor that later. The biggest concern I currently have is that we are storing the external id in plain text. I am engaging with AWS AppSec to understand the best practices around storage of the external id. |
Hi, AWS IAM documentation state that:
This external ID is visible to anyone who has IAM read access and access to the AWS account. It is not stored as a secret |
Hi! Great job done here. Looking forward to use this feature when approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution here, I have left some comments on stuff that I'd like changed. Since this PR has been sitting for a while I'm inclined to approve as-is and I can work on the changes in a separate PR. Let me know your thoughts or if you disagree with any of my suggestions.
Lastly, after engaging with my AWS AppSec team they would like to take a crack at testing an image prior to releasing for public consumption.
Thank you so much for your contribution! It is really well done.
AWS AppSec did not find any problems with this approach. I'm going to engage a teammate to give this another review and then we'll merge it. I'll work on the comments in a follow up PR. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marcosdiez, wweiwei-li, zac-nixon 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 |
Issue #3634
Description
Now, every time a
TargetGroupBinding
has thealb.ingress.kubernetes.io/IamRoleArnToAssume
(and optionallyalb.ingress.kubernetes.io/AssumeRoleExternalId
) annotations, we assume it before interacting to it (actually, the assume role operation is cached).In real life, I changed:
RegisterTargets
/DeregisterTargets
/ListTargets
This way we can easily manipulate target groups from target group bindings for every single AWS account in the world, as long as there is a role we can assume. In order to prevent the confused deputy problem,
external id
is supported.The way this was implemented was actually way simpler than initially imagined:
the
service.elbv2Client
object now supports a new method calledAssumeRole
which returnsservice.elbv2Client
on the specified role. The catch is that ifAssumeRole
is called with a blank role, the object returns itself and life goes on.In other words, every time we call some method from
elbv2Client
from something related to target groups, we also callAssumeRole
and that's basically it.Caching the assumed role was also trivial, a simple map that is stored on
cloud.go
I decided to have
cloud.go
manage the caching becuase in the future it could assume role for other objects if needed and all the assume role logic would be in the same place.The only unfortunate change that needed to be made is that
aws.Cloud
becameservices.Cloud
else golang would complain about circular dependency :(This is what the logs look like:
Documentation and tests were properly updated in this PR
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯
A working amd64 container with this code is available here:
marcosdiez/aws-load-balancer-controller:v2.7.2-m2
update: on 2024-09-26 I rebased the code. The new container image is
marcosdiez/aws-load-balancer-controller:v2.8.3-m2
update: on 2024-10-28 I rebased the code again :(. The new container image is
marcosdiez/aws-load-balancer-controller:v2.9.0-m1