Skip to content

Gateway TLS without hostname (FQDN discovery) + TS AppHost endpoint fix - #16551

Merged
Mitch Denny (mitchdenny) merged 14 commits into
mainfrom
feature/gateway-tls-no-hostname
Apr 30, 2026
Merged

Gateway TLS without hostname (FQDN discovery) + TS AppHost endpoint fix#16551
Mitch Denny (mitchdenny) merged 14 commits into
mainfrom
feature/gateway-tls-no-hostname

Conversation

@mitchdenny

@mitchdenny Mitch Denny (mitchdenny) commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds support for Gateway TLS without a pre-known hostname and fixes endpoint resource lookup for TypeScript AppHosts.

1. Gateway TLS without pre-known hostname (FQDN auto-discovery)

When WithTls() is called without WithHostname(), the Gateway now:

  1. Generates an HTTPS listener without a hostname restriction
  2. After Helm deploy, a new tls-fqdn-discovery pipeline step polls kubectl get gateway for the assigned address (up to 5 min)
  3. Discovers Hostname-type addresses, dynamically finds HTTPS listeners without hostnames, and patches them with the discovered FQDN
  4. Creates a bootstrap self-signed TLS secret (with SAN) with the discovered FQDN
  5. cert-manager then detects the hostname on the listener and issues a real certificate

This enables single-deploy TLS for controllers like AGC that assign FQDNs automatically (e.g., *.alb.azure.com).

2. Helm field manager conflict fix

After patching the Gateway hostname, re-applies a minimal Gateway manifest (apiVersion, kind, metadata with annotations/labels, spec — no server fields) with --server-side --field-manager=helm --force-conflicts to transfer field ownership back to Helm. This prevents SSA conflicts when the user later redeploys with an explicit hostname via WithHostname().

3. TypeScript AppHost endpoint resource lookup fix

Uses ResourceNameComparer on the deploymentTargets dictionary so that endpoint references created through the TypeScript AppHost RPC bridge (which may use a different resource instance) resolve correctly by resource name. This matches the pattern already used in KubernetesEnvironmentContext._kubernetesComponents.

Testing

  • All 116 K8S tests pass
  • New test: AddGateway_WithTls_NoHostname_GeneratesHttpsListenerWithoutHostname
  • Tested on AKS cluster with AGC: Gateway TLS with hostname + HTTP-01 cert-manager
  • Tested TS AppHost with Gateway route — HTTPRoute now correctly generated

When WithTls() is called without WithHostname(), the Gateway now:
1. Generates an HTTPS listener without a hostname restriction
2. After Helm deploy, polls Gateway status for the assigned address
3. Patches the HTTPS listener to add the discovered hostname
4. Creates a bootstrap self-signed TLS secret with the discovered FQDN
5. cert-manager then detects the hostname and issues a real certificate

This enables a single-deploy TLS workflow for controllers like AGC that
assign FQDNs automatically (e.g., *.alb.azure.com), without requiring
users to deploy once to discover the FQDN and then redeploy with it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
After patching the Gateway hostname via JSON patch, re-apply the full
Gateway YAML with --server-side --field-manager=helm --force-conflicts
to transfer field ownership back to Helm. This prevents SSA conflicts
when the user later redeploys with an explicit hostname via WithHostname().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 06:11
@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16551

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16551"

@mitchdenny

Copy link
Copy Markdown
Member Author

Sébastien Ros (@sebastienros) David Fowler (@davidfowl) — Heads up on a resource identity issue with the TS AppHost RPC bridge that I've worked around in this PR.

The hack: Lines 653-668 and 872-890 in KubernetesEnvironmentResource.cs add a name-based fallback when looking up deployment targets by resource reference.

The problem: When EndpointReference is created through the ATS capability layer (e.g. app.getEndpoint('http') from TypeScript), the .Resource property is a different object instance than the resource in appModel.GetComputeResources(). The Dictionary<IResource, KubernetesResource> lookup via TryGetValue (reference equality) fails, so no HTTPRoute is generated for the Gateway.

Impact: This likely affects any deployment target that does resource lookups by reference — Docker Compose has the same ResourceMapping.TryGetValue(resource, ...) pattern in DockerComposeEnvironmentContext.cs.

Repro: TS AppHost with addGateway().withGatewayPathRoute('/', app.getEndpoint('http')) — the route is silently skipped without the name-based fallback.

The real fix should be in the ATS bridge to preserve resource identity so that EndpointReference.Resource is the same instance as the one in the app model.

@mitchdenny

Copy link
Copy Markdown
Member Author

Repro AppHost (TypeScript):

import { createBuilder } from "./.modules/aspire.js";

const builder = await createBuilder();

// This creates a NodeAppResource on the C# side and registers a handle in the ATS HandleRegistry.
// The "app" resource is added to the app model (appModel.GetComputeResources() will include it).
const app = await builder
    .addNodeApp("app", "./api", "src/index.ts")
    .withHttpEndpoint({ env: "PORT" })
    .withExternalHttpEndpoints();

// At this point, "app" is a resolved NodeAppResource (the promise was awaited).
// Calling getEndpoint("http") sends an RPC call to C# which does:
//   builder.Resource.GetEndpoint("http")
// This creates an EndpointReference whose .Resource property should be the same
// NodeAppResource instance that is in the app model. But it appears to be a
// DIFFERENT instance — possibly because the ATS handle resolution wraps or
// re-creates the resource when crossing the RPC boundary.
const endpoint = await app.getEndpoint("http");

const k8s = await builder.addKubernetesEnvironment("env");

// When this route is processed during publish, the code does:
//   deploymentTargets.TryGetValue(endpointRef.Resource, out var k8sResource)
//
// deploymentTargets was populated from appModel.GetComputeResources() — keyed
// by the ORIGINAL resource instance. But endpointRef.Resource is a DIFFERENT
// instance (same name "app", different object reference), so TryGetValue returns
// false and the route is silently skipped. No HTTPRoute is generated.
await k8s.addGateway("ingress")
    .withGatewayClass("azure-alb-external")
    .withGatewayPathRoute("/", endpoint)  // <-- endpoint.Resource != appModel resource
    .withHostname("myapp.example.com")
    .withGatewayTlsAuto();

await builder.build().run();

The same AppHost works perfectly in C# because GetEndpoint returns an EndpointReference holding the exact same resource instance — no RPC boundary to cross.

@mitchdenny
Mitch Denny (mitchdenny) marked this pull request as draft April 29, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Kubernetes Gateway TLS support for cases where the Gateway hostname isn’t known at publish time by generating hostless HTTPS listeners and introducing a post-deploy pipeline step that discovers the assigned address and patches the Gateway/listeners, plus a workaround for TypeScript AppHost endpoint resource identity mismatches.

Changes:

  • Generate HTTPS Gateway listeners even when WithTls() is used without WithHostname() (hostless listener) and add a new deploy pipeline step to discover and patch the listener hostname post-deploy.
  • Add name-based fallback matching when resolving EndpointReference.Resource to Kubernetes deployment targets (to unblock TS AppHost/Gateway route generation).
  • Add a new unit test asserting TLS-without-hostname produces an HTTPS listener without a hostname field in the rendered Gateway YAML.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
tests/Aspire.Hosting.Kubernetes.Tests/KubernetesGatewayTests.cs Adds coverage for generating an HTTPS listener when TLS is configured without an explicit hostname.
src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs Implements hostless HTTPS listener generation, adds FQDN discovery + patching pipeline step, and introduces TS AppHost deployment-target lookup fallback.

Comment on lines +996 to +1004
string? discoveredFqdn = null;
var maxAttempts = 60; // 5 minutes with 5s intervals
for (var attempt = 0; attempt < maxAttempts; attempt++)
{
var jsonPathArgs = $"get gateway {gatewayName} --namespace {@namespace} -o jsonpath=\"{{.status.addresses[0].value}}\"";
if (environment.KubeConfigPath is not null)
{
jsonPathArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";
}

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

The Gateway address discovery reads only .status.addresses[0].value and treats it as an FQDN, but Gateway status addresses can be IPAddress as well as Hostname and ordering isn’t guaranteed. If an IP is returned here, patching it into spec.listeners[].hostname (and using it as the cert CN) will be invalid. Consider selecting the first address with type == "Hostname" (or validating the value as a DNS name) and skipping discovery with a clear warning when only IPs are available.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My agent found this problem as well. 😄

Comment on lines +1051 to +1056
// Find HTTPS listeners without a hostname and patch them with the discovered FQDN.
// We query the Gateway spec to find the correct listener indices dynamically.
var listenerJsonArgs = $"get gateway {gatewayName} --namespace {@namespace} -o jsonpath=\"{{.spec.listeners}}\"";
if (environment.KubeConfigPath is not null)
{
listenerJsonArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

kubectl ... -o jsonpath="{.spec.listeners}" output is not guaranteed to be valid JSON, but the code immediately feeds it to JsonDocument.Parse. This will likely throw for many clusters/controllers, and the fallback index assumption can patch the wrong listener. Prefer kubectl get gateway ... -o json and then parse spec.listeners from the JSON to reliably locate HTTPS listeners missing hostname.

Copilot uses AI. Check for mistakes.
Comment on lines +1120 to +1150
var patchOps = string.Join(",", httpsListenerIndices.Select(
idx => $"{{\"op\":\"add\",\"path\":\"/spec/listeners/{idx}/hostname\",\"value\":\"{discoveredFqdn}\"}}"));
var patchJson = $"[{patchOps}]";

var patchArgs = $"patch gateway {gatewayName} --namespace {@namespace} --type=json -p=\"{patchJson.Replace("\"", "\\\"")}\"";
if (environment.KubeConfigPath is not null)
{
patchArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";
}

var (patchResult, patchDisposable) = ProcessUtil.Run(new ProcessSpec("kubectl")
{
Arguments = patchArgs,
ThrowOnNonZeroReturnCode = false,
InheritEnv = true,
OnOutputData = line => context.Logger.LogDebug("{Line}", line),
OnErrorData = line => context.Logger.LogDebug("{Line}", line)
});

await using (patchDisposable.ConfigureAwait(false))
{
var patchExitResult = await patchResult.WaitAsync(context.CancellationToken).ConfigureAwait(false);
if (patchExitResult.ExitCode != 0)
{
context.Logger.LogWarning(
"Failed to patch Gateway '{GatewayName}' with hostname '{Hostname}' (exit code {ExitCode}). " +
"You may need to redeploy with an explicit hostname via WithHostname().",
gatewayName, discoveredFqdn, patchExitResult.ExitCode);
continue;
}
}

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

The JSON patch payload is assembled via string interpolation with discoveredFqdn embedded directly. If the discovered value contains quotes/backslashes/whitespace (or is otherwise unexpected), this can break the JSON patch and can also alter the kubectl argument parsing. It would be safer to build the patch ops using JsonSerializer (so the hostname value is JSON-escaped) and avoid manual Replace-based escaping.

Suggested change
var patchOps = string.Join(",", httpsListenerIndices.Select(
idx => $"{{\"op\":\"add\",\"path\":\"/spec/listeners/{idx}/hostname\",\"value\":\"{discoveredFqdn}\"}}"));
var patchJson = $"[{patchOps}]";
var patchArgs = $"patch gateway {gatewayName} --namespace {@namespace} --type=json -p=\"{patchJson.Replace("\"", "\\\"")}\"";
if (environment.KubeConfigPath is not null)
{
patchArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";
}
var (patchResult, patchDisposable) = ProcessUtil.Run(new ProcessSpec("kubectl")
{
Arguments = patchArgs,
ThrowOnNonZeroReturnCode = false,
InheritEnv = true,
OnOutputData = line => context.Logger.LogDebug("{Line}", line),
OnErrorData = line => context.Logger.LogDebug("{Line}", line)
});
await using (patchDisposable.ConfigureAwait(false))
{
var patchExitResult = await patchResult.WaitAsync(context.CancellationToken).ConfigureAwait(false);
if (patchExitResult.ExitCode != 0)
{
context.Logger.LogWarning(
"Failed to patch Gateway '{GatewayName}' with hostname '{Hostname}' (exit code {ExitCode}). " +
"You may need to redeploy with an explicit hostname via WithHostname().",
gatewayName, discoveredFqdn, patchExitResult.ExitCode);
continue;
}
}
var patchOperations = httpsListenerIndices.Select(idx => new
{
op = "add",
path = $"/spec/listeners/{idx}/hostname",
value = discoveredFqdn
});
var patchJson = System.Text.Json.JsonSerializer.Serialize(patchOperations);
var patchFilePath = System.IO.Path.GetTempFileName();
await System.IO.File.WriteAllTextAsync(patchFilePath, patchJson, context.CancellationToken).ConfigureAwait(false);
try
{
var patchArgs = $"patch gateway {gatewayName} --namespace {@namespace} --type=json --patch-file \"{patchFilePath}\"";
if (environment.KubeConfigPath is not null)
{
patchArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";
}
var (patchResult, patchDisposable) = ProcessUtil.Run(new ProcessSpec("kubectl")
{
Arguments = patchArgs,
ThrowOnNonZeroReturnCode = false,
InheritEnv = true,
OnOutputData = line => context.Logger.LogDebug("{Line}", line),
OnErrorData = line => context.Logger.LogDebug("{Line}", line)
});
await using (patchDisposable.ConfigureAwait(false))
{
var patchExitResult = await patchResult.WaitAsync(context.CancellationToken).ConfigureAwait(false);
if (patchExitResult.ExitCode != 0)
{
context.Logger.LogWarning(
"Failed to patch Gateway '{GatewayName}' with hostname '{Hostname}' (exit code {ExitCode}). " +
"You may need to redeploy with an explicit hostname via WithHostname().",
gatewayName, discoveredFqdn, patchExitResult.ExitCode);
continue;
}
}
}
finally
{
try
{
System.IO.File.Delete(patchFilePath);
}
catch (System.IO.IOException)
{
}
catch (UnauthorizedAccessException)
{
}
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +1152 to +1164
// Transfer field ownership to Helm using server-side apply so subsequent
// Helm deploys don't encounter SSA conflicts on the patched hostname field.
var currentGatewayArgs = $"get gateway {gatewayName} --namespace {@namespace} -o yaml";
if (environment.KubeConfigPath is not null)
{
currentGatewayArgs += $" --kubeconfig \"{environment.KubeConfigPath}\"";
}

var gatewayYamlLines = new List<string>();
var (getGwResult, getGwDisposable) = ProcessUtil.Run(new ProcessSpec("kubectl")
{
Arguments = currentGatewayArgs,
ThrowOnNonZeroReturnCode = false,

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

Re-applying the output of kubectl get gateway ... -o yaml risks including server-populated/read-only fields (e.g., status, metadata.resourceVersion, metadata.managedFields). Depending on kubectl/version and CRD schema, kubectl apply can fail or behave unpredictably. Consider generating a minimal manifest containing only apiVersion/kind/metadata(name,namespace)/spec (or re-applying the Helm-rendered YAML) before doing server-side apply for field ownership transfer.

Copilot uses AI. Check for mistakes.
Comment on lines +1174 to +1176
{
var tempFile = Path.GetTempFileName();
try

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

Temp file creation uses Path.GetTempFileName(). In this repo, prefer creating temp files under a securely created temp directory (e.g., Directory.CreateTempSubdirectory() and then Path.Combine) rather than using GetTempFileName, to align with the temporary directory guidance and avoid leaving pre-created temp files behind on failures.

Copilot generated this review using guidance from repository custom instructions.
context.Logger.LogInformation("Creating bootstrap TLS secret '{SecretName}' for '{Hostname}'.", secretName, discoveredFqdn);

using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP256);
var certRequest = new CertificateRequest($"CN={discoveredFqdn}", ecdsa, HashAlgorithmName.SHA256);

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

The bootstrap self-signed cert is created with only a CN. Modern TLS clients generally require the hostname to be present in the Subject Alternative Name (SAN) extension; CN-only certs can be rejected. Consider adding a SAN DNS name extension for the discovered hostname so the temporary certificate is usable during the window before cert-manager replaces it.

Suggested change
var certRequest = new CertificateRequest($"CN={discoveredFqdn}", ecdsa, HashAlgorithmName.SHA256);
var certRequest = new CertificateRequest($"CN={discoveredFqdn}", ecdsa, HashAlgorithmName.SHA256);
var subjectAlternativeNameBuilder = new SubjectAlternativeNameBuilder();
subjectAlternativeNameBuilder.AddDnsName(discoveredFqdn);
certRequest.CertificateExtensions.Add(subjectAlternativeNameBuilder.Build());

Copilot uses AI. Check for mistakes.
Use ResourceNameComparer on the deploymentTargets dictionary so that
endpoint references created through the TypeScript AppHost RPC bridge
(which may use a different resource instance) resolve correctly by
resource name. This matches the pattern already used in
KubernetesEnvironmentContext._kubernetesComponents.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny
Mitch Denny (mitchdenny) force-pushed the feature/gateway-tls-no-hostname branch from 5cd9269 to 0aba6af Compare April 29, 2026 06:30
@mitchdenny
Mitch Denny (mitchdenny) marked this pull request as ready for review April 29, 2026 07:30
The YAML serializer quotes string values like protocol: "HTTPS" on CI.
Use a more flexible assertion that matches both quoted and unquoted forms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

1. Address type validation: Parse full Gateway JSON status, prefer
   Hostname-type addresses, fall back to DNS-like values, skip IPs.
2. Use -o json instead of jsonpath: Parse full Gateway JSON for both
   address discovery and listener index detection. More reliable.
3. Use JsonSerializer + --patch-file: Build JSON patch operations with
   proper serialization, write to temp file to avoid shell escaping.
4. Minimal manifest for field ownership: Read current Gateway JSON,
   strip server fields (status, resourceVersion, managedFields), keep
   only apiVersion/kind/metadata(name,namespace)/spec for SSA apply.
5. Temp file pattern: Use CreateTempSubdirectory consistently.
6. Add SAN to bootstrap certs: Add SubjectAlternativeNameBuilder with
   DNS name in both DiscoverFqdnAndBootstrapTlsAsync and the existing
   BootstrapTlsSecretsAsync. Modern TLS clients require SAN.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The minimal manifest used for server-side apply field ownership transfer
was missing annotations and labels, causing AGC annotations like
alb.networking.azure.io/alb-name to be stripped. Now copies annotations
and labels from the current Gateway metadata.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

All automated review feedback addressed (commit ba38721 + 070bc04)

1. Address type validation (comment on line 988)
Addressed. Discovery now uses -o json and parses the full Gateway status via ExtractHostnameFromGatewayJson. It prefers addresses with type == "Hostname", falls back to DNS-like values (contains ., no :), and skips/warns when only IPs are available.

2. jsonpath output reliability (comment on line 1038)
Addressed. Both address discovery and listener index detection now use kubectl get gateway -o json with JsonDocument.Parse on the full JSON. The FindHostnamelessHttpsListeners helper parses spec.listeners from the full object.

3. JSON patch via string interpolation (comment on line 1132)
Addressed. JSON patch operations are now built with JsonSerializer.Serialize and written to a temp file passed via --patch-file. No more string interpolation or manual escaping.

4. Full YAML re-apply for field ownership (comment on line 1146)
Addressed. TransferGatewayFieldOwnership now reads the current Gateway JSON, strips server-populated fields (status, resourceVersion, managedFields), and builds a minimal manifest with only apiVersion, kind, metadata (name, namespace, annotations, labels), and spec. Also fixed a bug (070bc04) where annotations/labels were being stripped, which caused AGC to stop recognizing the Gateway.

5. Temp file pattern (comment on line 1158)
Addressed. All temp files now use Directory.CreateTempSubdirectory() + Path.Combine consistently, matching the pattern already used by BootstrapTlsSecretsAsync.

6. Bootstrap cert missing SAN (comment on line 1227)
Addressed. Both DiscoverFqdnAndBootstrapTlsAsync and the existing BootstrapTlsSecretsAsync now add a SubjectAlternativeNameBuilder with AddDnsName() so modern TLS clients accept the bootstrap cert.

@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
@github-actions
github-actions Bot temporarily deployed to deployment-testing April 29, 2026 10:24 Inactive
…ncer

Per the official AGC quickstart docs, use the correct flags:
- --enable-gateway-api: enables Gateway API CRDs
- --enable-application-load-balancer: enables ALB controller addon
- --network-plugin azure: required Azure CNI
- Standard_D2as_v5: AMD VM SKU for quota compatibility
- Use the add-on's auto-created aks-appgateway subnet instead of
  creating one manually

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

The ALB controller pods need time to initialize after cluster creation.
Poll until pods are Running and GatewayClass azure-alb-external exists,
with up to 10 minutes timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

cert-manager requires parentRefs to include a name. Use 'ingress' to
match the Gateway name from AddGateway('ingress'), and include the
namespace to match the Helm deploy namespace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

The injected AppHost code needs:
- using Aspire.Hosting.Kubernetes for AddGateway extension methods
- #pragma warning disable ASPIRECOMPUTE003 for AddContainerRegistry
Both prepended to the top of the file alongside ASPIREPIPELINES001.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

The starter template generates builder.AddProject('webfrontend') without
assigning to a variable. The Gateway route needs a reference to it, so
inject 'var webfrontend =' before the AddProject call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run


string? discoveredFqdn = null;
var maxAttempts = 60; // 5 minutes with 5s intervals
for (var attempt = 0; attempt < maxAttempts; attempt++)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would using Polly help here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea. Polly isn't currently referenced in Aspire.Hosting.Kubernetes so it would be a new dependency for this one retry loop. Happy to refactor if you think it's worth the dependency, or we could use the Microsoft.Extensions.Resilience helpers if those are available transitively. For now the manual loop matches the pattern used elsewhere in this file (e.g. the ALB ready polling in the E2E test).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Aspire.Hosting already references Polly.Core.

We don't need this. If you are happy with a loop - I just figured I'd ask.

Replace the manual for-loop retry with a Polly ResiliencePipeline
using constant 5s backoff, 60 max attempts, and result-based retry
(retries when result is null). Polly.Core is already a transitive
dependency via Aspire.Hosting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

@github-actions

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit 7510268)

View all recordings
Status Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DeployK8sBasicApiService ▶️ View Recording
DeployK8sWithGarnet ▶️ View Recording
DeployK8sWithMongoDB ▶️ View Recording
DeployK8sWithMySql ▶️ View Recording
DeployK8sWithPostgres ▶️ View Recording
DeployK8sWithRabbitMQ ▶️ View Recording
DeployK8sWithRedis ▶️ View Recording
DeployK8sWithSqlServer ▶️ View Recording
DeployK8sWithValkey ▶️ View Recording
DeployTypeScriptAppToKubernetes ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25140333612

@mitchdenny

Copy link
Copy Markdown
Member Author

/deployment-test

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #16551...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Deployment E2E Tests passed — 33 passed, 0 failed, 0 cancelled

View test results and recordings

View workflow run

Test Result Recording
Deployment.EndToEnd-TypeScriptVnetSqlServerInfraDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetKeyVaultConnectivityDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaCompactNamingDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetKeyVaultInfraDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-TypeScriptExpressDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetSqlServerInfraDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetSqlServerConnectivityDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetStorageBlobConnectivityDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-NspStorageKeyVaultDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureLogAnalyticsDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-KubernetesGatewayTlsDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-FrontDoorDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureEventHubsDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureContainerRegistryDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureKeyVaultDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureStorageDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureServiceBusDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AppServiceReactDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AuthenticationTests ✅ Passed
Deployment.EndToEnd-AksStarterDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksWithAzureResourcesDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksBlazorRedisDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksVnetWithAzureResourcesDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksVnetInfraDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksStarterWithRedisHelmDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaStarterDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaManagedRedisDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaDeploymentErrorOutputTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-VnetStorageBlobInfraDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaCustomRegistryDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AcaExistingRegistryDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AzureAppConfigDeploymentTests ✅ Passed ▶️ View Recording
Deployment.EndToEnd-AksMultipleNodePoolsDeploymentTests ✅ Passed ▶️ View Recording

@mitchdenny

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #782

Generated by PR Documentation Check

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

A draft documentation PR has been opened on microsoft/aspire.dev targeting the main branch (falling back from release/13.4 which does not yet exist on aspire.dev).

Branch: docs/aspire-16551-gateway-tls-fqdn-discovery

What was documented

Updated deployment/kubernetes.mdx with a new "Configure Gateway API and TLS" section covering:

  • Basic Gateway with routesAddGateway, WithGatewayClass, WithRoute (C# and TypeScript examples)
  • TLS with a known hostnameWithHostname + WithTls pattern
  • TLS with FQDN auto-discovery — calling WithTls() without WithHostname(), including an explanation of the new tls-fqdn-discovery pipeline step, its 5-minute FQDN polling behavior, listener patching, and self-signed TLS bootstrap

The draft PR needs human review before merging.

Generated by PR Documentation Check for issue #16551 · ● 1.7M ·

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants