-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to resolve target port #3305
Conversation
- Change how we process and expose target ports. This change makes it possible to avoid using any internals of DCP to access and resolve target ports from any resource. - More launch profile processing to the project resource defaults. - Remove logic in the manifest writing that wrote a special env variable. This should just work now like everything else. - Exposed TargetPort and Exists on EndpointReference. - Use this new target property with dapr. - Added a ReferenceExpressionBuilder which makes it possible to dynamically build a ReferenceExpression. - Endpoints and env are evaulated earlier now so change remove tests that add default launch profile on real projects without allocating those endpoints.
{ | ||
var launchProfile = project.GetEffectiveLaunchProfile(); | ||
if (launchProfile is not null && !string.IsNullOrWhiteSpace(launchProfile.CommandLineArgs)) | ||
var cmdArgs = launchProfile.CommandLineArgs.Split((string?)null, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should move to the project defaults as well #3306. I have a local change on top of this PR with that working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty neat; I really like how all the DCP details were encapsulated in this change.
Approving assuming that the launch profile command line argument handling will also go to ProjectResourceBuilderExtensions.
you going to backport to p6 @davidfowl? |
/// The associated service name created in DCP for this endpoint. | ||
/// </summary> | ||
public string? DcpServiceName { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is a great public name in our application model.
Users don't really know (and shouldn't know IMO) about DCP at all. Is there a better name we can use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OrchestratorServiceName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this isn’t generic even if we change the property name (which is fine).
Also we have lots of dcp in the config, logging etc do we want to do a single pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it internal for now? We can always make it public later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes it impossible to write a test. This is difficult because we need something that can appear in string interpolated expression. It doesn’t need to be the dcp expression but it has to be something that we can detect and replace with the dcp expression, at runtime .
There’s another alternative that comes to mind:
Make it internal: Delete the property:
Don’t evaluate this object inside of the IValueProvider implementation, but have that object flow all the way out to evaluation phase (GetValue) in ApplicationExecutor.
I think that means we’d need to manually process ReferenceExpressions in GetValue, handling target port specially.
* Added ability to resolve target port - Change how we process and expose target ports. This change makes it possible to avoid using any internals of DCP to access and resolve target ports from any resource. - More launch profile processing to the project resource defaults. - Remove logic in the manifest writing that wrote a special env variable. This should just work now like everything else. - Exposed TargetPort and Exists on EndpointReference. - Use this new target property with dapr. - Added a ReferenceExpressionBuilder which makes it possible to dynamically build a ReferenceExpression. - Endpoints and env are evaulated earlier now so change remove tests that add default launch profile on real projects without allocating those endpoints. * Remove more uses of TestProgram * Fix tests
* Added ability to resolve target port - Change how we process and expose target ports. This change makes it possible to avoid using any internals of DCP to access and resolve target ports from any resource. - More launch profile processing to the project resource defaults. - Remove logic in the manifest writing that wrote a special env variable. This should just work now like everything else. - Exposed TargetPort and Exists on EndpointReference. - Use this new target property with dapr. - Added a ReferenceExpressionBuilder which makes it possible to dynamically build a ReferenceExpression. - Endpoints and env are evaulated earlier now so change remove tests that add default launch profile on real projects without allocating those endpoints. * Remove more uses of TestProgram * Fix tests
* Added ability to resolve target port (#3305) * Added ability to resolve target port - Change how we process and expose target ports. This change makes it possible to avoid using any internals of DCP to access and resolve target ports from any resource. - More launch profile processing to the project resource defaults. - Remove logic in the manifest writing that wrote a special env variable. This should just work now like everything else. - Exposed TargetPort and Exists on EndpointReference. - Use this new target property with dapr. - Added a ReferenceExpressionBuilder which makes it possible to dynamically build a ReferenceExpression. - Endpoints and env are evaulated earlier now so change remove tests that add default launch profile on real projects without allocating those endpoints. * Remove more uses of TestProgram * Fix tests * Rename DcpServiceName to TargetPortExpression (#3371) This allows us to not leak "DCP" into the public API and keeps DCP-isms contained in the DCP code. * Do not set TargetPort to Port when IsProxying is also set (#3372) * Do not set TargetPort to Port when IsProxied is true * Move TargetPort check to ApplicationExecutor * Apply port selection logic to manifest publishing (cherry picked from commit 09f5ae9) * Update src/Aspire.Hosting/Dcp/ApplicationExecutor.cs Co-authored-by: Eric Erhardt <[email protected]> --------- Co-authored-by: Eric Erhardt <[email protected]> --------- Co-authored-by: David Fowler <[email protected]> Co-authored-by: Reuben Bond <[email protected]>
cc @DamianEdwards this should fix dapr and the tests.
Goal is to have this go into p6 (API fit and finish).