forked from LaconicNetwork/kompose
Fix port duplicate in container spec (#1223)
This commit is contained in:
parent
25337eb82c
commit
0a2fa1a978
@ -547,8 +547,12 @@ func (k *Kubernetes) CreatePVC(name string, mode string, size string, selectorVa
|
||||
// ConfigPorts configures the container ports.
|
||||
func (k *Kubernetes) ConfigPorts(name string, service kobject.ServiceConfig) []api.ContainerPort {
|
||||
ports := []api.ContainerPort{}
|
||||
exist := map[string]bool{}
|
||||
for _, port := range service.Port {
|
||||
|
||||
// temp use as an id
|
||||
if exist[string(port.ContainerPort)+string(port.Protocol)] {
|
||||
continue
|
||||
}
|
||||
// If the default is already TCP, no need to include it.
|
||||
if port.Protocol == api.ProtocolTCP {
|
||||
ports = append(ports, api.ContainerPort{
|
||||
@ -562,6 +566,7 @@ func (k *Kubernetes) ConfigPorts(name string, service kobject.ServiceConfig) []a
|
||||
HostIP: port.HostIP,
|
||||
})
|
||||
}
|
||||
exist[string(port.ContainerPort)+string(port.Protocol)] = true
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -135,9 +135,6 @@
|
||||
"imagePullPolicy": "",
|
||||
"name": "etherpad",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 9001
|
||||
},
|
||||
{
|
||||
"containerPort": 9001
|
||||
}
|
||||
|
||||
@ -127,9 +127,6 @@
|
||||
"name": "etherpad",
|
||||
"image": " ",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 9001
|
||||
},
|
||||
{
|
||||
"containerPort": 9001
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ services:
|
||||
image: tuna/docker-counter23
|
||||
ports:
|
||||
- "5000:5000/tcp"
|
||||
- "5001:5000/tcp"
|
||||
links:
|
||||
- redis
|
||||
networks:
|
||||
|
||||
@ -59,6 +59,11 @@
|
||||
"name": "5000",
|
||||
"port": 5000,
|
||||
"targetPort": 5000
|
||||
},
|
||||
{
|
||||
"name": "5001",
|
||||
"port": 5001,
|
||||
"targetPort": 5000
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
|
||||
@ -59,6 +59,11 @@
|
||||
"name": "5000",
|
||||
"port": 5000,
|
||||
"targetPort": 5000
|
||||
},
|
||||
{
|
||||
"name": "5001",
|
||||
"port": 5001,
|
||||
"targetPort": 5000
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
|
||||
@ -229,9 +229,6 @@
|
||||
],
|
||||
"workingDir": "/code",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 3000
|
||||
},
|
||||
{
|
||||
"containerPort": 3000
|
||||
},
|
||||
|
||||
@ -229,9 +229,6 @@
|
||||
],
|
||||
"workingDir": "/code",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 3000
|
||||
},
|
||||
{
|
||||
"containerPort": 3000
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user