Use scheme instead of endpoint name when registering service discovery environment variables#14626
Conversation
…y environment variables
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14626Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14626" |
There was a problem hiding this comment.
Pull request overview
Updates Aspire Hosting’s service discovery environment variable naming so the key segment uses the endpoint scheme (e.g., https, http) instead of the endpoint name, aligning emitted configuration with how .NET service discovery matches URIs.
Changes:
- Generate
services__{serviceName}__{scheme}__{index}keys (with per-scheme indexing for multiple endpoints sharing a scheme). - Update unit tests and publisher snapshot baselines to reflect the new key format.
- Refresh XML docs/comments describing the service discovery env-var format.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/WithReferenceTests.cs | Updates assertions to expect scheme-based services__... keys. |
| tests/Aspire.Hosting.Kubernetes.Tests/Snapshots/KubernetesPublisherTests.KubernetesWithProjectResources#06.verified.yaml | Updates Helm chart snapshot to use scheme-based service discovery keys and indices. |
| tests/Aspire.Hosting.Kubernetes.Tests/Snapshots/KubernetesPublisherTests.KubernetesWithProjectResources#01.verified.yaml | Updates values snapshot to use scheme-based service discovery keys and indices. |
| tests/Aspire.Hosting.Docker.Tests/Snapshots/DockerComposePublisherTests.DockerComposeWithProjectResources.verified.yaml | Updates Docker Compose snapshot to use scheme-based service discovery keys and indices. |
| src/Aspire.Hosting/ResourceBuilderExtensions.cs | Switches service discovery key generation from endpoint name to scheme; updates some related XML docs. |
| src/Aspire.Hosting/ApplicationModel/ReferenceEnvironmentInjectionFlags.cs | Updates enum XML docs to describe scheme-based service discovery key format. |
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22329806400 |
|
This is a breaking change right? |
It’s both a breaking change and a bug fix (we’d made similar breaking changes in 13.1 as part of the new https support, but missed this one). |
|
I tagged it as such. |
…y environment variables (#14626) * Use scheme instead of endpoint name when registering service discovery environment variables * Respond to PR comments * Simplify OTLP extraction to avoid service discovery lookup
|
After thinking about it I think this should have combined endpointName and scheme instead of just replacing one with the other. I think its very valid that more then one endpoint is going to use the https/http scheme but unlikely that it is for the same endpoint name. See: Those have nothing in common, but now the management endpoint is used instead of the http endpoint. See: |
Description
Updates the service discovery environment variable names to use the endpoint scheme rather than the endpoint name when building the environment variable name (i.e.
services__{service name}__{scheme}__0instead ofservices__{service name}__{endpoint name}__0).Fixes #14411