Fix Kubernetes hostname publishing and routing - #19430
Conversation
Preserve runtime-only parameters as Helm values and apply configured hostnames to hostless Ingress paths and Gateway routes. Keep default backends catch-all outside the existing TLS compatibility behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5d87339-2d36-4690-8422-801dfac7e135
|
/deployment-test |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19430Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19430" |
There was a problem hiding this comment.
Pull request overview
Fixes #17755 by preserving deploy-time hostname parameters and applying configured hostnames to Kubernetes routing resources.
Changes:
- Emits owner-scoped Helm values for deferred parameters and secrets.
- Applies hostnames to hostless Ingress and Gateway routes while preserving explicit hosts and default backends.
- Adds documentation and snapshot tests.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs |
Implements deferred values and hostname inheritance. |
src/Aspire.Hosting.Kubernetes/KubernetesIngressExtensions.cs |
Documents Ingress routing behavior. |
src/Aspire.Hosting.Kubernetes/KubernetesGatewayExtensions.cs |
Documents Gateway routing behavior. |
tests/Aspire.Hosting.Kubernetes.Tests/KubernetesIngressTests.cs |
Adds Ingress regression tests. |
tests/Aspire.Hosting.Kubernetes.Tests/KubernetesGatewayTests.cs |
Adds Gateway regression tests. |
...Ingress...RuntimeOnlyHostnameParameter...#00.verified.yaml |
Verifies deferred Ingress hostname output. |
...Ingress...RuntimeOnlyHostnameParameter...#01.verified.yaml |
Verifies Ingress Helm values. |
...Ingress...Hostname_AppliesToHostlessPath.verified.yaml |
Verifies inherited Ingress hosts. |
...Ingress...DefaultBackendWithoutTls...verified.yaml |
Verifies catch-all default backend. |
...Gateway...RuntimeOnlyHostnameParameter...#00.verified.yaml |
Verifies deferred Gateway listener. |
...Gateway...RuntimeOnlyHostnameParameter...#01.verified.yaml |
Verifies deferred HTTPRoute hostname. |
...Gateway...RuntimeOnlyHostnameParameter...#02.verified.yaml |
Verifies Gateway Helm values. |
...Gateway...Hostname_AppliesToHostlessRoute.verified.yaml |
Verifies inherited HTTPRoute hosts. |
Review details
Suppressed comments (1)
src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs:1150
- The inherited
HTTPRoute.spec.hostnamesbehavior is validated only as generated YAML. Add or extend a deployment end-to-end test to deploy a Gateway withWithHostname(...)and verify matching and nonmatching host requests, so listener/route attachment and Helm substitution are exercised together.
else
{
httpRoute.Spec.Hostnames.AddRange(resolvedHostnames);
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Balanced
|
🚀 Deployment tests starting on PR #19430... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Eric Erhardt (eerhardt)
left a comment
There was a problem hiding this comment.
Reviewed the hostname routing and deploy-time parameter handling changes. No blocking issues found.
|
/deployment-test |
|
🚀 Deployment tests starting on PR #19430... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
Pull request created: #1574
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1574 targeting Added a "Hostname inheritance for paths and routes" section to Note This draft PR needs human review before merging. |
|
The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests. Suspected flaky test(s): Suggested actions:
You can re-run the failed jobs from the workflow run page. |
Description
Kubernetes publishing currently hardcodes runtime-only hostname parameter values and leaves hostless Ingress paths and Gateway routes as catch-all rules. This means
WithHostname(...)does not provide the documented routing scope andpublishValueAsDefault: falseis not honored for these resources.This change:
HTTPRouteresources;User-facing usage
C# AppHost:
The generated Ingress now scopes the route and TLS configuration with a deploy-time value:
TypeScript AppHost:
Validation
Aspire.Hosting.Kubernetes.Tests: 287 passedAzureKubernetesIngressTests: 8 passedFixes #17755
Checklist
<remarks />and<code />elements on your triple slash comments?