Skip to content
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

Make the dashboard an appmodel resource #3453

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Apr 6, 2024

  • Moved dashboard resource into a lifecycle hook instead of making it a dcp resource. This removes the specialized code from ApplicationExecutor from knowing about the dashboard. As a result of this change I also cleaned up how we configure and validate dcp options to use IConfigureOptions and IValidateOptions.

AI generated:

This pull request includes changes to the Aspire.Hosting project, specifically to the DashboardLifecycleHook.cs and ApplicationExecutor.cs files. The changes mainly revolve around the removal of the dashboard configuration and lifecycle hooks, the addition of a new lifecycle hook, and modifications to the state of the dashboard resource.

Here are the most important changes:

  • src/Aspire.Hosting/Dashboard/DashboardLifecycleHook.cs: A new lifecycle hook was added. This hook configures the dashboard resource before the start of the application. It checks if the dashboard resource exists and configures it, or adds a new dashboard resource if it doesn't exist. The configuration includes setting up the dashboard path, working directory, executable resource, and environment variables.

Removal of dashboard configuration from ApplicationExecutor:

  • src/Aspire.Hosting/Dcp/ApplicationExecutor.cs: Several methods related to the dashboard configuration were removed, including ConfigureAspireDashboardResource, StartDashboardAsDcpExecutableAsync, GetDashboardEnvironmentVariablesAsync, and PrintDashboardUrls. Also, the dashboard configuration was removed from the RunApplicationAsync method.

Modifications to dashboard resource state:

Other changes:

Fixes #3450

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Apr 6, 2024
@davidfowl davidfowl requested review from mitchdenny and JamesNK April 6, 2024 16:47
- Moved dashboard resource into a lifecycle hook instead of making it a dcp resource.
This removes the specialized code from ApplicationExecutor from knowing about the dashboard.
As a result of this change I also cleaned up how we configure and validate dcp options to use IConfigureOptions and IValidateOptions.
- Added tests for the dashboard resource
- Made a change to ApplicationExecutor to allow resources that start as
hidden to remain hidden.
@davidfowl davidfowl force-pushed the davidfowl/isolate-dashboard-resource branch from 6e7cf1e to ef23c70 Compare April 6, 2024 19:46
@davidfowl davidfowl requested a review from eerhardt April 6, 2024 19:55
@davidfowl
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mitchdenny
Copy link
Member

This is a huge change but good one. Makes things a lot cleaner.

Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor things.

- Added hidden to a new known resource states class
- Added more test cases
@davidfowl davidfowl merged commit a352e43 into main Apr 8, 2024
8 checks passed
@davidfowl davidfowl deleted the davidfowl/isolate-dashboard-resource branch April 8, 2024 01:32
_innerBuilder.Services.AddSingleton<IKubernetesService, KubernetesService>();
// DCP stuff
_innerBuilder.Services.AddSingleton<ApplicationExecutor>();
_innerBuilder.Services.AddSingleton<IDashboardEndpointProvider, HostDashboardEndpointProvider>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostDashboradEndpointProvider is being added regardless of whether the dashboard is enabled.

davidfowl added a commit that referenced this pull request Apr 10, 2024
* Make the dashboard an appmodel resource

- Moved dashboard resource into a lifecycle hook instead of making it a dcp resource.
This removes the specialized code from ApplicationExecutor from knowing about the dashboard.
As a result of this change I also cleaned up how we configure and validate dcp options to use IConfigureOptions and IValidateOptions.
- Added tests for the dashboard resource
- Made a change to ApplicationExecutor to allow resources that start as
hidden to remain hidden.
- Added hidden to a new known resource states class
- Added more test cases
joperezr pushed a commit that referenced this pull request Apr 10, 2024
* Improve service address allocation (#3294)

* Improve service address allocation
Should fix #3265

* Make the dashboard an appmodel resource (#3453)

* Make the dashboard an appmodel resource

- Moved dashboard resource into a lifecycle hook instead of making it a dcp resource.
This removes the specialized code from ApplicationExecutor from knowing about the dashboard.
As a result of this change I also cleaned up how we configure and validate dcp options to use IConfigureOptions and IValidateOptions.
- Added tests for the dashboard resource
- Made a change to ApplicationExecutor to allow resources that start as
hidden to remain hidden.
- Added hidden to a new known resource states class
- Added more test cases

* Only add dashboard services if the dashboard is enabled (#3489)

* Only add dashboard services if the dashboard is enabled

* Don't wait until after we've started the entire app to print the token (#3472)

- Print it right after we print the dashboard url
- Refactored the dashboard resource to use DashboardOptions instead of DcpOptions

---------

Co-authored-by: Karol Zadora-Przylecki <karolz@microsoft.com>
Co-authored-by: Reuben Bond <203839+ReubenBond@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make dashboard a separate apphost resource
4 participants