-
Notifications
You must be signed in to change notification settings - Fork 39
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
Dapr azure hosting ext #371
base: main
Are you sure you want to change the base?
Dapr azure hosting ext #371
Conversation
Create Dapr Azure Redis project Create Example AppHost + ApiService
Create Dapr resource for provisioning
Use AddAzureInfrastructure
Add AzureDaprComponentResource Start of unit tests
Fixes based on unit tests
2. **`ConfigureRedisStateComponent`** | ||
Internal helper that creates and configures a “state.redis” Dapr component based on the `AzureRedisCacheResource`. | ||
- Generates a valid hostname and port. | ||
- Supports Azure Entra ID (AadEnabled) for secure access. | ||
- Stores or references secrets in Azure Key Vault if password-based authentication is required. |
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.
Not sure internal details need to be in the readme
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.
Have adjusted docs
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.
As I was doing the review, it made me wonder if it wouldn't make more sense to create a single package, CommunityToolkit.Aspire.Hosting.Dapr.Azure
.
My understanding is that the AzureExtensions
package doesn't really do anything on its own, you'd need to bring in a package such as the Dapr.AzureRedis
one or you'd create your own using some other Azure service to act as the caching layer in Azure.
Is the risk that if you aren't wanting to use Azure Redis as the caching layer you're going to end up bringing in some dependencies that are unneeded to the application (and thus "bloat")?
I guess I don't know enough about Dapr and what's needed/how you go about hosting it in Azure to truly understand what alternatives there might need to be in the future.
@@ -22,7 +22,6 @@ | |||
|
|||
<Target Name="PublishRunMaven" AfterTargets="Build"> | |||
<!-- As part of publishing, ensure the Java app is freshly built --> | |||
<Exec WorkingDirectory="$(JavaAppRoot)" Command="./mvnw --quiet clean package" /> |
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 you revert this change, as we have a PR to resolve it (and it'll cause builds to fail if it's not included at the moment)
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.
Done - I'm pretty sure I didn't intentionally remove this.
...tyToolkit.Aspire.Hosting.Dapr.AzureExtensions/ApplicationModel/AzureDaprComponentResource.cs
Outdated
Show resolved
Hide resolved
public static IResourceBuilder<AzureDaprComponentResource> AddAzureDaprResource( | ||
this IResourceBuilder<IDaprComponentResource> builder, | ||
[ResourceName] string name, | ||
Action<AzureResourceInfrastructure> configureInfrastructure) |
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 parameter is non-null and thus required, is that intended?
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.
Yes it is intended and required because it is necessary
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.
Is someone always going to need to provide their own configuration callback? Could it not be nullable and we have a default (even if it's just a noop)?
Or is it more that these are methods that you wouldn't realistically use in isolation, you'd only use them through wrappers like the Dapr Azure Redis package?
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 mean you could no-op it, but I don't see a use case where you would use it without configuration.
It is primarily designed to be used by the wrappers - and I'm sitting here arguing with myself whether you would realistically use it in isolation.
On one hand if a wrapped integration exists for the component you're wanting to use - it makes sense to use that, however if not this integration avoids the pain I experienced trying to figure it out.
I think provided that I (or someone) can contribute wrapped version in a timely manner then this library could in fact be a supporting library that wasn't published separately?
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.
The more I think about this the more I think that this shouldn't be published on it's own and should only serve as the base for more specific integrations.
src/CommunityToolkit.Aspire.Hosting.Dapr.AzureExtensions/AzureDaprHostingExtensions.cs
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Dapr.AzureExtensions/AzureDaprHostingExtensions.cs
Show resolved
Hide resolved
tests/CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis.Tests/ResourceCreationTests.cs
Outdated
Show resolved
Hide resolved
tests/CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis.Tests/ResourceCreationTests.cs
Outdated
Show resolved
Hide resolved
tests/CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis.Tests/ResourceCreationTests.cs
Outdated
Show resolved
Hide resolved
tests/CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis.Tests/ResourceCreationTests.cs
Outdated
Show resolved
Hide resolved
tests/CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis.Tests/ResourceCreationTests.cs
Outdated
Show resolved
Hide resolved
…cationModel/AzureDaprComponentResource.cs Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
…sourceCreationTests.cs Co-authored-by: Aaron Powell <[email protected]>
@aaronpowell yeah it would be a pretty bloated integration. Dapr has multiple "building blocks" - state is just one of these building blocks can be used with redis, cosmosdb, postgres, table / blob storage or sql server (to name the azure ones). so you would end up referencing a rather large number of the aspire hosting packages. which felt like it is contra to the design of aspire. |
public static IResourceBuilder<AzureDaprComponentResource> AddAzureDaprResource( | ||
this IResourceBuilder<IDaprComponentResource> builder, | ||
[ResourceName] string name, | ||
Action<AzureResourceInfrastructure> configureInfrastructure) |
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.
Is someone always going to need to provide their own configuration callback? Could it not be nullable and we have a default (even if it's just a noop)?
Or is it more that these are methods that you wouldn't realistically use in isolation, you'd only use them through wrappers like the Dapr Azure Redis package?
I'm wondering if the Azure Extensions package should ship as a source-only package (see https://andrewlock.net/creating-source-only-nuget-packages/) so that there's one less binary people would end up with, as they'd compile in the stuff they need (also means things could be marked as internal for library authors). |
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 think this looks good - anything else outstanding in your opinion @FullStackChef
Closes #349
PR Checklist
Other information