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

keep port when exists #4018

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cli/azd/pkg/apphost/aca_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ func pickIngress(endpointByTargetPortProperties map[string]*acaPort, httpIngress
finalIngress.TargetPort = props.port
if finalIngress.TargetPort == 0 {
finalIngress.TargetPort = defaultPort
} else {
// negative target port means the target port is defined in the manifest and is not using a default value
// azd won't change the value of the target port after building a dotnet project. azd will just use the
// value defined in the manifest (will remove the negative).
finalIngress.TargetPort *= -1
}
finalIngress.Transport = acaIngressSchemaHttp
if props.hasHttp2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ properties:
autoConfigureDataProtection: true
ingress:
external: true
targetPort: {{ targetPortOrDefault 3000 }}
targetPort: {{ targetPortOrDefault -3000 }}
vhvb1989 marked this conversation as resolved.
Show resolved Hide resolved
transport: http
allowInsecure: false
registries:
Expand Down
5 changes: 5 additions & 0 deletions cli/azd/pkg/project/service_target_dotnet_containerapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ func (at *dotnetContainerAppTarget) Deploy(
"securedParameter": fns.Parameter,
"secretOutput": fns.kvSecret,
"targetPortOrDefault": func(targetPortFromManifest int) int {
if targetPortFromManifest < 0 {
// a negative target port means the target port was defined in the manifest and should not
// be changed.
return targetPortFromManifest * -1
}
// portNumber is 0 for dockerfile.v0, so we use the targetPort from the manifest
if portNumber == 0 {
return targetPortFromManifest
Expand Down
Loading