Rename Ingress WithRoute to WithPath; split Gateway path enum#17424
Conversation
Aligns the Kubernetes Ingress builder API with the YAML it actually emits: spec.rules[].http.paths[]. WithPath replaces WithRoute on KubernetesIngressResource (overloads for path-only and host+path), and the internal IngressRouteConfig / Routes collection become IngressPathConfig / Paths. KubernetesGatewayResource keeps WithRoute, which correctly maps to the HTTPRoute object the Gateway API spec models. Also decouples the Gateway from IngressPathType by introducing GatewayPathMatchType (PathPrefix / Exact / RegularExpression), matching the Gateway API path match vocabulary. The Gateway HTTPRoute builder no longer silently translates Ingress 'Prefix' into Gateway 'PathPrefix'. ATS / AspireExport IDs: - withIngressPathRoute -> withIngressPath - withIngressHostRoute -> withIngressHostAndPath This is a clean rename (no [Obsolete] shim). Docs, playground examples, the aspire-deployment skill reference, and tests have all been updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17424Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17424" |
There was a problem hiding this comment.
Pull request overview
Updates Aspire’s Kubernetes publishing APIs to better match the underlying Kubernetes specs by renaming the Ingress authoring surface from “route” to “path”, while keeping “route” semantics for Gateway API (HTTPRoute) and splitting the path match enums to avoid cross-spec vocabulary mismatches.
Changes:
- Ingress: rename
WithRoute(...)→WithPath(...), and rename internal route config/storage to path-based naming. - Gateway: introduce
GatewayPathMatchType(PathPrefix/Exact/RegularExpression) and stop reusingIngressPathTypeto avoid incorrect translations. - Update unit tests and deployment skill reference docs to reflect the new API names/terminology.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Kubernetes.Tests/KubernetesIngressTests.cs | Updates Ingress tests to use WithPath and renames several test cases accordingly. |
| tests/Aspire.Hosting.Azure.Kubernetes.Tests/AzureKubernetesIngressTests.cs | Updates AKS Ingress tests to use WithPath. |
| src/Aspire.Hosting.Kubernetes/KubernetesIngressResource.cs | Renames internal “routes” list/config to “paths” and updates docs/examples. |
| src/Aspire.Hosting.Kubernetes/KubernetesIngressExtensions.cs | Renames Ingress builder API to WithPath and updates ATS export names. |
| src/Aspire.Hosting.Kubernetes/KubernetesGatewayResource.cs | Adds GatewayPathMatchType enum and updates gateway route config to use it. |
| src/Aspire.Hosting.Kubernetes/KubernetesGatewayExtensions.cs | Updates Gateway WithRoute overloads to accept GatewayPathMatchType. |
| src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs | Updates Ingress processing to use Paths; updates Gateway HTTPRoute match type mapping. |
| src/Aspire.Hosting.Kubernetes/Extensions/EndpointRoutingValidation.cs | Updates doc text to reflect WithPath vs WithRoute call sites. |
| src/Aspire.Hosting.Azure.Kubernetes/AzureKubernetesIngressExtensions.cs | Updates docs/examples to use WithPath for Ingress. |
| .agents/skills/aspire-deployment/references/kubernetes.md | Updates skill reference guidance to mention Ingress WithPath and Gateway WithRoute. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 3
CI surfaced a string-literal AppHost in KubernetesPublishRequiresExternalEndpointTests that still referenced .WithRoute(...) on an Ingress builder. The Gateway sibling test correctly stays on .WithRoute(...). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/deployment-test |
|
🚀 Deployment tests starting on PR #17424... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
❌ Deployment E2E Tests failed — 36 passed, 4 failed, 0 cancelled View test results and recordings
|
- Use InvalidOperationException with descriptive message for unknown GatewayPathMatchType instead of ArgumentOutOfRangeException with a parameter name that doesn't exist on the method (fixes CA2208). - Update stale 'route' terminology in Ingress test comments and method names to match the new WithPath surface. - Replace mojibake (ΓÇö) with plain ASCII in a test comment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❓ CLI E2E Tests unknown — 96 passed, 0 failed, 5 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26373573286 |
|
✅ No documentation update needed. Triggered signals: The Aspire 13.3 What's New page ( Please apply these two one-line changes manually to |
…Path - Resolve each ParameterResource individually when the outer expression raises MissingParameterValueException, so parameters with publishValueAsDefault still get inlined in mixed-parameter expressions (per JamesNK review feedback). - Update new ingress tests to use WithPath after WithRoute was renamed on KubernetesIngressResource in #17424. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
) * Fix WithIngressClass parameter resolution for Kubernetes publish When an ingress (or gateway) resource referenced a ParameterResource via WithIngressClass, WithHostname, WithTls, etc., the generated YAML rendered the literal format string "{0}" for unresolved parameters instead of a Helm template expression. This made the published Helm chart unusable unless the parameter had a value at publish time. ResolveExpressionAsync now substitutes unresolved parameters with Helm template references (`{{ .Values.parameters.<resource>.<param> }}` or the secrets variant) and registers them in CapturedHelmValues so: - The deploy-time values override file gets the resolved value. - The chart's values.yaml has a placeholder entry, preventing helm template from emitting <no value>. Deploy-time pipeline callers (TLS bootstrap, gateway address discovery) use a new static ResolveExpressionAtDeployTimeAsync that preserves the prior fallback behavior, since those run after parameters are expected to be resolved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review feedback: propagate missing-parameter exceptions and use TryGetValue - ResolveValueProviderAsync no longer swallows MissingParameterValueException for non-ParameterResource value providers. Silently substituting empty string would have produced invalid Kubernetes manifest fields (e.g., secretName: '') that fail opaquely at deploy time. Letting it propagate surfaces the unresolved-parameter problem during publish. - EnsureCapturedHelmValuePlaceholders now uses TryGetValue on _helmValues so the guard is real instead of relying on the indexer throwing first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR feedback: inline resolvable params, rename WithRoute->WithPath - Resolve each ParameterResource individually when the outer expression raises MissingParameterValueException, so parameters with publishValueAsDefault still get inlined in mixed-parameter expressions (per JamesNK review feedback). - Update new ingress tests to use WithPath after WithRoute was renamed on KubernetesIngressResource in #17424. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Mitch Denny <midenn@orangecake.localdomain> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
The Kubernetes Ingress builder used
WithRoute(...), but the YAML it emits has no "route" noun — each call adds an entry tospec.rules[].http.paths[]. The Gateway API builder also usedWithRoute(...), which is correct there (one call ≈ one HTTPRoute rule), but both builders sharedIngressPathTypeso Gateway code silently translated IngressPrefixinto GatewayPathPrefix.This PR makes the public API match the underlying spec for each integration:
WithRoute→WithPath(both overloads: path-only and host+path). InternalIngressRouteConfig/RoutesbecomeIngressPathConfig/Paths. ATS exports:withIngressPath+withIngressHostAndPath.WithRoute(correctly models HTTPRoute) but no longer borrowsIngressPathType. NewGatewayPathMatchTypeenum with Gateway API vocabulary (PathPrefix/Exact/RegularExpression), and the HTTPRoute mapping now passes the value through directly instead of translating from Ingress terminology.Clean rename, no
[Obsolete]shim. Doc comments, examples, the aspire-deployment skill reference, playground AppHosts, and tests were all updated to match.api/*.csfiles are intentionally untouched per repo policy — they regenerate at release time.All 295 affected tests pass (
Aspire.Hosting.Kubernetes.Tests233/233,Aspire.Hosting.Azure.Kubernetes.Tests62/62).Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?