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

Add missing port configuration to AddAzurePostgresFlexibleServer RunAsContainer #6276

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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