Support dynamic Host header rewrite with sourceHeader in ListenerRuleConfiguration CRD#4697
Conversation
|
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yaswanthkumar1995 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @yaswanthkumar1995! |
|
Hi @yaswanthkumar1995. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
…Configuration CRD Adds support for specifying host-header-rewrite transforms directly through the ListenerRuleConfiguration CRD, enabling multi-tenant SaaS patterns where the Host header needs to be dynamically rewritten using the value of another incoming request header (e.g., X-School-Domain). Changes: - Add Transforms field to ListenerRuleConfigurationSpec with support for host-header-rewrite transform type - Add SourceHeader field to host-header-rewrite config for cross-header reference (forward-looking for when AWS ALB adds native support) - Add BuildListenerRuleConfigTransforms to convert CRD transforms to internal model transforms - Add mergeTransforms to merge route-level and CRD-level transforms, with CRD transforms taking precedence for same-type overrides - Add unit tests for new functionality Ref: kubernetes-sigs#4693
66310a0 to
661507d
Compare
Issue
#4693
Description
Adds support for specifying
host-header-rewritetransforms directly through theListenerRuleConfigurationCRD, enabling multi-tenant SaaS patterns where the Host header needs to be dynamically rewritten using the value of another incoming request header (e.g.,X-School-Domain).This implements Option A from the issue — a new
transformsfield in the ListenerRuleConfiguration CRD with asourceHeaderreference:What changed:
apis/gateway/v1beta1/listenerruleconfig_types.goTransformsfield toListenerRuleConfigurationSpecwithhost-header-rewritetype,sourceHeader, and kubebuilder validation markerspkg/model/elbv2/listener_rule.goSourceHeaderfield toRewriteConfigObjectinternal modelpkg/gateway/routeutils/route_rule_transform.goBuildListenerRuleConfigTransforms()to convert CRD transforms to internal modelpkg/gateway/model/model_build_listener.gomergeTransforms()— merges route-level and CRD-level transforms, CRD takes precedence for same-type overridesDesign decisions:
sourceHeaderis a forward-looking field. AWS ALB does not yet natively support cross-header references (confirmed by AWS Premium Support). The field is wired through the CRD and internal model so that when AWS adds SDK support, only the SDK builder (buildSDKHostHeaderRewriteConfig) needs updating.host-header-rewritereplaces one generated from HTTPRoute hostname matching).host-header-rewriteonly — no url-rewrite in the CRD since it wasn't requested.Checklist
README.md, or thedocsdirectory)