mirror of
https://github.com/docker/compose.git
synced 2026-08-03 22:27:30 +00:00
Allow unspecified protocol on exposed port in kube backend
Signed-off-by: Michael Irwin <mikesir87@gmail.com> The Compose spec doesn't provide a default value, but the code was defaulting to TCP in the service protocol, just not in the name. If no protocol was specified, it would cause an invalid service name (eg, "80-")
This commit is contained in:
parent
8fd04195be
commit
e62bfc87c2
1 changed files with 3 additions and 2 deletions
|
|
@ -92,12 +92,13 @@ func mapToService(project *types.Project, service types.ServiceConfig) *core.Ser
|
|||
if p.Published != 0 {
|
||||
serviceType = core.ServiceTypeLoadBalancer
|
||||
}
|
||||
protocol := toProtocol(p.Protocol)
|
||||
ports = append(ports,
|
||||
core.ServicePort{
|
||||
Name: fmt.Sprintf("%d-%s", p.Published, strings.ToLower(p.Protocol)),
|
||||
Name: fmt.Sprintf("%d-%s", p.Published, strings.ToLower(string(protocol))),
|
||||
Port: int32(p.Published),
|
||||
TargetPort: intstr.FromInt(int(p.Target)),
|
||||
Protocol: toProtocol(p.Protocol),
|
||||
Protocol: protocol,
|
||||
})
|
||||
}
|
||||
if len(ports) == 0 { // headless service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue