Skip to content

Conversation

@zac-nixon
Copy link
Collaborator

@zac-nixon zac-nixon commented Oct 21, 2025

Description

Add support for literal Target Group ARNs in the Gateway API

Summary

This change adds support for specifying literal Target Groups in Gateway API backend references. It also refactors the backend data structure to allow other backend types (like Gateways for ALB as a Target of NLB).

Details

  • Allow backend references to specify other kinds (Service and TargetGroupName)
  • Refactored existing TargetGroupARNMapper utility to be shared.
  • Refactor Gateway and Ingress reconcilers to use the shared mapper.
  • Add unit tests for literal ARN handling and mapping logic.
  • Remove un-used parameters like typeSpecificBackend and GetSectionName
  • Fixed a discovered bug with TG config not being cleaned up if a Gateway is not programmed due invalid configuration.

Testing:

  • Ran E2E tests to ensure no regressions
  • Tested setting static TG, change to a different TG name, then using a service again.

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 the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 21, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 21, 2025
allGateways = append(allGateways, k8s.NamespacedName(gw))

if gw.Status.Conditions != nil {
for _, cond := range gw.Status.Conditions {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the fix for not cleaning up TG configs due to an invalid Gateway config.

rules:
- backendRefs:
- group: ""
kind: TargetGroupName
Copy link
Collaborator

@shraddhabang shraddhabang Oct 22, 2025

Choose a reason for hiding this comment

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

NIT: Do we wanna make it more specific to AWS? Calling it AWSTargetGroupName?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I buried the reasoning for not using ARN in the code:
// GW API limits names to 253 characters, while a TG ARN might be 256, so just using the name.

Yeah, that's a good idea to make it AWS specific.

}

type LiteralTargetGroupConfig struct {
// GW API limits names to 253 characters, while a TG ARN might be 256, so just using the name.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok got it. NVM my earlier comment.

var literalTargetGroup *LiteralTargetGroupConfig
var warn error
var fatal error
// We only support references of type service.
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT : Leftover comment?

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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 22, 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 f83f7bb into kubernetes-sigs:main Oct 23, 2025
9 checks passed
@zac-nixon zac-nixon deleted the znixon/gw-backend-refactor branch October 23, 2025 06:53
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. 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