Skip to content

Fix deletion guard for Gateway TargetGroupConfigurations still referenced by TCPRoutes#4802

Open
immanuwell wants to merge 1 commit into
kubernetes-sigs:mainfrom
immanuwell:fix/gateway-tgc-delete-guard
Open

Fix deletion guard for Gateway TargetGroupConfigurations still referenced by TCPRoutes#4802
immanuwell wants to merge 1 commit into
kubernetes-sigs:mainfrom
immanuwell:fix/gateway-tgc-delete-guard

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

Issue

None

Description

Gateway-targeted TargetGroupConfigurations are a documented path for gateway chaining, but delete reconciliation only guarded Service targets.

So if a TCPRoute still points at a Gateway backend, deleting the TGC can drop the finalizer and remove the config while it is still referenced. Tiny edge case, but its real.

This patch adds the missing in-use check for targetReference.kind: Gateway and covers it with tests.

Repro:

  1. Create a TargetGroupConfiguration with targetReference.kind: Gateway.
  2. Create a TCPRoute that uses that Gateway as a backend.
  3. Delete the TGC.
  4. Before this patch, the controller can remove the finalizer anyway.
  5. With this patch, deletion stays blocked until the TCPRoute reference is gone.

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 🌟

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: immanuwell
Once this PR has been reviewed and has the lgtm label, please assign wweiwei-li for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@kubernetes-prow kubernetes-prow Bot requested review from shraddhabang and shuqz June 26, 2026 07:06
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 26, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @immanuwell. 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.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

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.

Details

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.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 26, 2026
@immanuwell

Copy link
Copy Markdown
Contributor Author

@shraddhabang @shuqz please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant