Skip to content

New WithEndpointsInEnvironment method#4679

Merged
mitchdenny merged 11 commits intomicrosoft:mainfrom
davidebbo:skip-env-injection
Jul 11, 2024
Merged

New WithEndpointsInEnvironment method#4679
mitchdenny merged 11 commits intomicrosoft:mainfrom
davidebbo:skip-env-injection

Conversation

@davidebbo
Copy link
Copy Markdown
Contributor

@davidebbo davidebbo commented Jun 26, 2024

Fixes #4472

Microsoft Reviewers: Open in CodeFlow

@davidebbo davidebbo requested a review from mitchdenny as a code owner June 26, 2024 17:09
@ghost ghost added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jun 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 26, 2024
@dotnet-bot
Copy link
Copy Markdown
Contributor

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.ServiceDiscovery Branch 81 80.13 🔻
Microsoft.Extensions.ServiceDiscovery Line 81 80.94 🔻

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=722400&view=codecoverage-tab

@mitchdenny
Copy link
Copy Markdown
Member

OK, so I'll reiterate my comment above here that I think that the EnvironmentInjectionFilterEntry type could just be an annotation (which means it could possibly work across resource types more easily as well).

Also we need a live test that covers the endpoint filtering so that the code path in ApplicationExecutor is validated.

@davidebbo
Copy link
Copy Markdown
Contributor Author

OK, so I'll reiterate my comment above here that I think that the EnvironmentInjectionFilterEntry type could just be an annotation (which means it could possibly work across resource types more easily as well).

To make sure I understand, what you're suggestion is an implementation change, but not a change to the public API, right? i.e. we would add an annotation for each filter, instead of using alternate data structures. And this annotation would be internal, right?

@mitchdenny
Copy link
Copy Markdown
Member

@davidebbo that's right. The annotation will probably need to be public also.

@davidebbo
Copy link
Copy Markdown
Contributor Author

davidebbo commented Jul 8, 2024 via email

@davidebbo
Copy link
Copy Markdown
Contributor Author

davidebbo commented Jul 8, 2024

@mitchdenny I changed it to used annotations to see what that feels like.

Misc comments:

  • It fits well into the annotation model, and does make the code a bit simpler.
  • The annotation index has no bearing on the behavior. i.e. I did not make it such that a given filter only affects annotations that come before it, as that felt quirky.
  • It's a bit less efficient as we need to cycle through all annotations each time we want to test a filter.
  • I kept the annotation internal for now, as it has kind of an ugly name, and I'm not clear what scenario we're enabling by making it public. If public, users might try to add it to other resource types, and I think for now, @davidfowl wanted to limit this to Projects. This could easily be revisited later.
  • I modified a live executor test to cover this (EndpointPortsProjectNoPortNoTargetPort)

@mitchdenny
Copy link
Copy Markdown
Member

@davidebbo this is looking good. Thanks for this submission. Unless there is anything else you think we should wait for I'd like to get this merged in.

@davidebbo
Copy link
Copy Markdown
Contributor Author

@mitchdenny I think it's good to go. Thanks for the review and suggestions!

@mitchdenny mitchdenny merged commit 421f8b1 into microsoft:main Jul 11, 2024
@mitchdenny mitchdenny mentioned this pull request Jul 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to define what endpoints are selected as ASPNETCORE_URLS, HTTP/HTTPS_PORTS and Kestrel endpoints

4 participants