Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.

Home Page:https://aka.ms/azd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aspire custom port not mapped to ACA ingress exposedPort

amolenk opened this issue · comments

Output from azd version
azd version 1.9.2 (commit c58b02f)

Describe the bug
When you use a custom port number in an Aspire project (for a Kafka or PostgreSQL container for example), the custom port number isn't set as the ingress exposedPort when deploying to ACA.

To Reproduce
Set up an Aspire project that uses custom port numbers:

var kafka = builder.AddKafka("kafka", port: 6000);
var postgres = builder.AddPostgres("postgres", port: 6001);

var rideService = builder.AddProject<Projects.Application_RideService>("ride-service")
	.WithReference(postgres)
	.WithReference(kafka);

Deploy to ACA using azd init/azd up

Expected behavior
The rideService in the example should be able to connect to Kafka over port 6000. It can't because the exposedPort is set to 0 in the ingress:

"ingress": {
        "allowInsecure": false,
        "clientCertificateMode": null,
        "corsPolicy": null,
        "customDomains": null,
        "exposedPort": 0,
        "external": false,
        "fqdn": "kafka.internal.__________________.swedencentral.azurecontainerapps.io",
        "ipSecurityRestrictions": null,
        "stickySessions": null,
        "targetPort": 9092,
        "traffic": [
          {
            "latestRevision": true,
            "weight": 100
          }
        ],
        "transport": "Tcp"
      },

I'd expect the exposedPort to be 6000. Connection succeeds when I change it manually in the portal after deployment.

(Moved here from dotnet/aspire#4232)

This is fixed here #3941