Skip to content
Merged
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
15 changes: 6 additions & 9 deletions src/pkg/cli/compose/fixup.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ func FixupServices(ctx context.Context, provider client.Provider, project *compo
slices.Sort(config.Names) // sort for binary search

// Fixup ports first (which affects service name replacement by ReplaceServiceNameWithDNS)
for _, svccfg := range project.Services {
for i, port := range svccfg.Ports {
svccfg.Ports[i] = fixupPort(port)
}
}

// Fixup any pseudo services (this might create port configs, which will affect service name replacement by ReplaceServiceNameWithDNS)
for _, svccfg := range project.Services {
Expand Down Expand Up @@ -67,6 +62,10 @@ func FixupServices(ctx context.Context, provider client.Provider, project *compo
fixupLLM(&svccfg)
}

for i, port := range svccfg.Ports {
svccfg.Ports[i] = fixupPort(port)
}

// update the concrete service with the fixed up object
project.Services[svccfg.Name] = svccfg
}
Expand Down Expand Up @@ -245,8 +244,7 @@ func fixupPostgresService(svccfg *composeTypes.ServiceConfig, provider client.Pr
for i, port := range svccfg.Ports {
if port.Mode == Mode_INGRESS || port.Mode == "" {
svccfg.Ports[i].Mode = Mode_HOST
svccfg.Ports[i].Published = "" // ignore published port in host mode
svccfg.Ports[i].AppProtocol = "" // ignore app protocol in host mode
svccfg.Ports[i].Published = "" // ignore published port in host mode
}
}
}
Expand Down Expand Up @@ -315,8 +313,7 @@ func fixupRedisService(svccfg *composeTypes.ServiceConfig, provider client.Provi
for i, port := range svccfg.Ports {
if port.Mode == Mode_INGRESS || port.Mode == "" {
svccfg.Ports[i].Mode = Mode_HOST
svccfg.Ports[i].Published = "" // ignore published port in host mode
svccfg.Ports[i].AppProtocol = "" // ignore app protocol in host mode
svccfg.Ports[i].Published = "" // ignore published port in host mode
}
}
}
Expand Down
Loading