Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
43cbdd1
Add AKS starter deployment E2E test (Phase 1)
Feb 5, 2026
6ef79de
Fix AKS test: register required resource providers
Feb 5, 2026
7b754c1
Fix AKS test: use Standard_B2s_v2 VM size
Feb 5, 2026
886b180
Fix AKS test: use Standard_D2s_v3 VM size
Feb 5, 2026
4318b51
Add Phase 2 & 3: Aspire project creation, Helm chart generation, and …
Feb 5, 2026
d38acb6
Fix Kubernetes deployment: Add container build/push step
Feb 5, 2026
f46b53e
Fix duplicate Service ports in Kubernetes publisher
Feb 5, 2026
f175bca
Add explicit AKS-ACR attachment verification step
Feb 5, 2026
3ab65aa
Fix AKS image pull: correct Helm value paths and add ACR check
Feb 6, 2026
da42bb7
Fix duplicate Service/container ports: compare underlying values not …
Feb 6, 2026
1057b42
Re-enable AppService deployment tests
Feb 6, 2026
45adcbb
Add endpoint verification via kubectl port-forward to AKS test
Feb 6, 2026
c2aa4d7
Wait for pods to be ready before port-forward verification
Feb 6, 2026
41dd194
Use retry loop for health endpoint verification and log HTTP status c…
Feb 6, 2026
d1d6551
Use real app endpoints: /weatherforecast and / instead of /health
Feb 6, 2026
1934af2
Improve comments explaining duplicate port dedup rationale
Feb 6, 2026
a9bbfb9
Refactor cleanup to async pattern matching other deployment tests
Feb 6, 2026
f3aed68
Fix duplicate K8s ports: skip DefaultHttpsEndpoint in ProcessEndpoints
Feb 6, 2026
5fa81a7
Add AKS + Redis E2E deployment test
Feb 6, 2026
7d3be48
Fix ACR name collision between parallel AKS tests
Feb 6, 2026
dd62bbf
Fix Redis Helm deployment: provide missing cross-resource secret value
Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Aspire.Hosting.Kubernetes/Extensions/ResourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,22 @@ internal static StatefulSet ToStatefulSet(this IResource resource, KubernetesRes
},
};

// Defense-in-depth: deduplicate ports by underlying value and protocol.
// The primary fix is in ProcessEndpoints() which skips the DefaultHttpsEndpoint
// (matching the core framework's SetBothPortsEnvVariables behavior). This dedup
// remains as a safety net for edge cases where multiple endpoints might still
// resolve to the same port value.
// See: https://github.com/dotnet/aspire/issues/14029
var addedPorts = new HashSet<(string Port, string Protocol)>();
foreach (var (_, mapping) in context.EndpointMappings)
{
var portValue = mapping.Port.ValueString ?? mapping.Port.ToScalar();
var portKey = (portValue, mapping.Protocol);
if (!addedPorts.Add(portKey))
{
continue; // Skip duplicate port/protocol combinations
}

service.Spec.Ports.Add(
new()
{
Expand Down Expand Up @@ -268,8 +282,17 @@ private static ContainerV1 WithContainerPorts(this ContainerV1 container, Kubern
return container;
}

// Defense-in-depth: deduplicate container ports (same rationale as ToService() above).
var addedPorts = new HashSet<(string Port, string Protocol)>();
foreach (var (_, mapping) in context.EndpointMappings)
{
var portValue = mapping.Port.ValueString ?? mapping.Port.ToScalar();
var portKey = (portValue, mapping.Protocol);
if (!addedPorts.Add(portKey))
{
continue;
}

container.Ports.Add(
new()
{
Expand Down
21 changes: 20 additions & 1 deletion src/Aspire.Hosting.Kubernetes/KubernetesResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,26 @@ private void ProcessEndpoints()

if (resolved.TargetPort.Value is null)
{
// Default endpoint for ProjectResource - deployment tool assigns port
// Default endpoint for ProjectResource - deployment tool assigns port.
// Skip the default https endpoint — the container won't listen on HTTPS.
// In Kubernetes, TLS termination is handled by ingress or service mesh.
// We still create an EndpointMapping (needed for service discovery env vars)
// but reuse the http endpoint's HelmValue so no duplicate K8s port is generated.
// This matches the core framework's SetBothPortsEnvVariables() behavior,
// which skips DefaultHttpsEndpoint when setting HTTPS_PORTS.
// See: https://github.com/dotnet/aspire/issues/14029
if (resource is ProjectResource projectResource &&
endpoint == projectResource.DefaultHttpsEndpoint)
{
// Find the existing http endpoint's HelmValue to share it
var httpMapping = EndpointMappings.Values.FirstOrDefault(m => m.Scheme == "http");
if (httpMapping is not null)
{
EndpointMappings[endpoint.Name] = new(endpoint.UriScheme, GetKubernetesProtocolName(endpoint.Protocol), resource.Name.ToServiceName(), httpMapping.Port, endpoint.Name);
continue;
}
}

GenerateDefaultProjectEndpointMapping(endpoint);
continue;
}
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Hosting/Aspire.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<InternalsVisibleTo Include="Aspire.Hosting.DotnetTool.Tests" />
<InternalsVisibleTo Include="Aspire.TestUtilities" />
<InternalsVisibleTo Include="Aspire.Cli.Tests" />
<InternalsVisibleTo Include="Aspire.Hosting.Kubernetes" />
<InternalsVisibleTo Include="Aspire.Hosting.RemoteHost" />
<InternalsVisibleTo Include="Aspire.Hosting.RemoteHost.Tests" />
<InternalsVisibleTo Include="Aspire.Hosting.CodeGeneration.TypeScript" />
Expand Down
Loading
Loading