Skip to content

Conversation

gabynevada
Copy link

@gabynevada gabynevada commented Oct 13, 2024

Description

The AddAzurePostgresFlexibleServer RunAsContainer does not have an exposed property to specify the running port like the AddPostgres method allows. This change adds the optional parameter to RunAsContainer and forwards it to the AddPostgres method used internally.

  • Added the same port parameter used on the AddPostgres method
  • Documented new parameter on RunAsContainer method
  • Updated public api reference

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue:
    • No
Microsoft Reviewers: Open in CodeFlow

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 13, 2024
@gabynevada
Copy link
Author

@dotnet-policy-service agree

@davidfowl davidfowl requested a review from eerhardt October 15, 2024 06:19
@davidfowl
Copy link
Member

@eerhardt Can you review? I think we want this for azure pg,sql and redis.

cc @mitchdenny as well.

@mitchdenny
Copy link
Member

To be consistent we'd probably have something like WithHostPort

@davidfowl
Copy link
Member

To be consistent we'd probably have something like WithHostPort

Are we going to do that for all containers? Just these 3? I Think we expose the actual container resource so that means WithHostPort will show up on all of these resources.

@eerhardt
Copy link
Member

eerhardt commented Oct 15, 2024

To be consistent we'd probably have something like WithHostPort

Are we going to do that for all containers? Just these 3? I Think we expose the actual container resource so that means WithHostPort will show up on all of these resources.

I don't think the current PR code is want it this way. We don't have this port parameter for CosmosDB or Azure Storage emulators. But instead you are expected to write:

builder.AddAzureCosmosDB("cosmos")
    .RunAsEmulator(container =>
    {
        container.WithGatewayPort(9000);
    });

builder.AddAzureStorage("storage")
    .RunAsEmulator(configureContainer: builder =>
    {
        builder.WithBlobPort(9001);
        builder.WithQueuePort(9002);
        builder.WithTablePort(9003);
    });

So instead, for PostgreSQL we should have:

builder.AddAzurePostgresFlexibleServer("pgsql")
    .RunAsContainer(configureContainer: builder =>
    {
        builder.WithHostPort(9004);
    });

@gabynevada
Copy link
Author

@eerhardt @mitchdenny Added requested changes for the PostgresServerResource.

Some follow up questions:

  • Is this the expected design?
  • Are other resource changes needed in this PR?

@mitchdenny
Copy link
Member

@gabynevada apologies for the slow response here. I think we'll look to take this in 9.1.

@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@eerhardt
Copy link
Member

eerhardt commented Apr 2, 2025

Thank you for your contribution and suggestion @gabynevada!

I'm going to close this PR in favor of Add ability to configure Port and Password for Redis and Postgres and SqlServer when they configured to run by RunAsContainer (dotnet/aspire#8439), since that PR contains the full fix for other resources as well.

@eerhardt eerhardt closed this Apr 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages 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.

4 participants