Validate container tunnel reserved container name#16748
Conversation
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750478d1-61db-4d74-ba05-0d874313bf58 Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750478d1-61db-4d74-ba05-0d874313bf58 Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750478d1-61db-4d74-ba05-0d874313bf58 Co-authored-by: karolz-ms <15271049+karolz-ms@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 -- 16748Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16748" |
There was a problem hiding this comment.
Pull request overview
Adds startup-time validation in Aspire Hosting so container resources cannot use the tunnel-reserved aspire name when the DCP container tunnel feature is enabled, and adds DCP executor tests for the new behavior.
Changes:
- Added reserved-name validation in
ContainerCreatorfor container resource names and explicit container names. - Added DCP executor tests covering rejection when the tunnel is enabled and acceptance when it is disabled.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Aspire.Hosting/Dcp/ContainerCreator.cs |
Adds validation for tunnel-reserved container naming during container preparation. |
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs |
Adds tests for reserved-name rejection and allowed behavior when the tunnel is disabled. |
… name Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/178c3676-f15b-4b6f-800c-55218cc56687 Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
No documentation PR is required for this change. Reason: This PR adds an internal startup validation that throws a descriptive
|
Description
Adds DCP container preparation validation that fails application startup when the Aspire container tunnel is enabled and a container resource name, explicit container name (
WithContainerName), or network alias (WithContainerNetworkAlias) matches the tunnel-reserved container nameaspire, using case-insensitive comparison. This prevents DNS/name conflicts with the container tunnel.Validation
./restore.sh.dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-method "*.RunApplicationAsync_ThrowsWhenContainerResourceNameConflictsWithContainerTunnelName" --filter-method "*.RunApplicationAsync_ThrowsWhenExplicitContainerNameConflictsWithContainerTunnelName" --filter-method "*.RunApplicationAsync_ThrowsWhenNetworkAliasConflictsWithContainerTunnelName" --filter-method "*.RunApplicationAsync_AllowsContainerNameMatchingContainerTunnelNameWhenContainerTunnelDisabled" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.DcpExecutorTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"(101 tests passed)Reviewer validation steps:
eng/scripts/get-aspire-cli-pr.sh <PR_NUMBER>oreng/scripts/get-aspire-cli-pr.ps1 <PR_NUMBER>.aspireorASPIRE(via resource name,WithContainerName, orWithContainerNetworkAlias).Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: