Skip to content
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

Follow up for 3691 [TargetGroupBindings can now manipulate target groups from different aws accounts] #4026

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

zac-nixon
Copy link
Collaborator

Issue

Previous PR, #3691

Issue, #3634

Description

The original PR (#3691) was a very good start to implementing cross account Target Group management and I used the same logic. This PR mostly fixes up bugs in the approach, as 3691 didn't work using SDKv2. Things I've added / changed:

  • Use a singleton STS client.
  • Use a garbage collected cache.
  • Do not hold on to assumed role elbv2 clients indefinitely, these clients eventually expire and need to be recreated.
  • Remove annotation based configuration for the Target Group Binding, instead rely only on the TGB spec to hold configuration data.
  • Fix TG ARN resolution (the previous PR didn't apply the same logic between ARN / name specification for the TG). Also refactored the logic to remove code duplication.
  • Add webhook validation to prevent specifying instance target groups + assume role. ELB API doesn't allow cross account instance registration.
  • Added documentation and examples.

Test Cases:

  • Same account TGB interactions work the same.
  • Cross account with valid role + external id works.
  • Cross account with invalid external id gracefully fails in the webhook validation.
  • Long running controller (5 days) has no significant memory increase nor any errors related to the AssumeRole management.

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 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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 21, 2025
@zac-nixon
Copy link
Collaborator Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 21, 2025
@@ -55,15 +55,6 @@ Kubernetes meta/v1.ObjectMeta
<table>
<tr><td><code>annotations</code></td><td>

<table>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed this. Trying to get the tool fixed to generate this properly, but it will make the CR huge

@zac-nixon zac-nixon force-pushed the znixon/multi-acc-tgb branch from b1f99d0 to 6625152 Compare January 21, 2025 19:03
@zac-nixon
Copy link
Collaborator Author

/retest

@zac-nixon zac-nixon force-pushed the znixon/multi-acc-tgb branch from 6625152 to dfae145 Compare January 24, 2025 19:42
Copy link
Collaborator

@shraddhabang shraddhabang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shraddhabang, 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:
  • OWNERS [shraddhabang,zac-nixon]

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 merged commit 388f1df into kubernetes-sigs:main Jan 24, 2025
9 checks passed
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants