Fix Kubernetes hostname publishing and routing - #19430
Fix Kubernetes hostname publishing and routing#19430Mitch Denny (mitchdenny) wants to merge 1 commit into
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. |
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 3 / 101 test projects · 3 jobs, from 13 changed files. Selected test projects (3 / 101)
Selected jobs (3)
How these were chosen — grouped by what changed🔧 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedThe PR changes Kubernetes publish-time parameter resolution and generated Ingress/Gateway routing behavior:
Files Changed
Change Categories
Test Scenarios ExecutedScenario 1: Runtime-only Ingress hostname parameterObjective: Verify a runtime-only parameter is emitted as a Helm input and is used by both the Ingress rule and TLS host. Coverage type: Happy path / original issue reproduction Status: PASS Steps:
Evidence:
Scenario 2: Inherited Ingress hosts and explicit-host precedenceObjective: Verify hostless paths are expanded across resource-level hosts while an explicit route host remains authoritative. Coverage type: Happy path / precedence boundary Status: PASS Steps:
Evidence:
Scenario 3: Runtime-only Gateway hostname parameterObjective: Verify a deferred hostname is shared by the Gateway HTTPS listener and generated HTTPRoute. Coverage type: Happy path / analogous Gateway behavior Status: PASS Steps:
Evidence:
Scenario 4: Default backend without TLSObjective: Verify a configured hostname does not incorrectly host-restrict an Ingress default backend. Coverage type: Boundary Status: PASS Steps:
Evidence:
Scenario 5: Non-external routed endpointObjective: Verify publish fails safely when an Ingress routes to an endpoint that was not explicitly marked external. Coverage type: Unhappy path Status: PASS Expected outcome: Non-zero publish exit with an actionable validation message. Observed outcome: Publish failed and identified resource Evidence:
Additional Validation
Summary
Overall ResultPASS - PR #19430 is verified at The original Ingress failure no longer reproduces, the equivalent Gateway path behaves consistently, precedence and default-backend boundaries are preserved, invalid endpoint exposure fails safely, and the full deployment E2E workflow remains green. |
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?