mirror of
https://github.com/caprover/caprover
synced 2026-05-06 03:30:29 +00:00
UDP or TCP unless unspecified
This commit is contained in:
@@ -543,16 +543,25 @@ class DockerApi {
|
||||
let ports = [];
|
||||
if (portsToMap) {
|
||||
for (let i = 0; i < portsToMap.length; i++) {
|
||||
ports.push({
|
||||
Protocol: 'tcp',
|
||||
TargetPort: portsToMap[i].containerPort,
|
||||
PublishedPort: portsToMap[i].hostPort
|
||||
});
|
||||
ports.push({
|
||||
Protocol: 'udp',
|
||||
TargetPort: portsToMap[i].containerPort,
|
||||
PublishedPort: portsToMap[i].hostPort
|
||||
});
|
||||
if (portsToMap[i].protocol) {
|
||||
ports.push({
|
||||
Protocol: portsToMap[i].protocol,
|
||||
TargetPort: portsToMap[i].containerPort,
|
||||
PublishedPort: portsToMap[i].hostPort
|
||||
});
|
||||
}
|
||||
else {
|
||||
ports.push({
|
||||
Protocol: 'tcp',
|
||||
TargetPort: portsToMap[i].containerPort,
|
||||
PublishedPort: portsToMap[i].hostPort
|
||||
});
|
||||
ports.push({
|
||||
Protocol: 'udp',
|
||||
TargetPort: portsToMap[i].containerPort,
|
||||
PublishedPort: portsToMap[i].hostPort
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,16 +1066,25 @@ class DockerApi {
|
||||
updatedData.EndpointSpec.Ports = [];
|
||||
for (let i = 0; i < ports.length; i++) {
|
||||
let p = ports[i];
|
||||
updatedData.EndpointSpec.Ports.push({
|
||||
Protocol: 'tcp',
|
||||
TargetPort: p.containerPort,
|
||||
PublishedPort: p.hostPort
|
||||
});
|
||||
updatedData.EndpointSpec.Ports.push({
|
||||
Protocol: 'udp',
|
||||
TargetPort: p.containerPort,
|
||||
PublishedPort: p.hostPort
|
||||
});
|
||||
if (p.protocol) {
|
||||
updatedData.EndpointSpec.Ports.push({
|
||||
Protocol: p.protocol,
|
||||
TargetPort: p.containerPort,
|
||||
PublishedPort: p.hostPort
|
||||
});
|
||||
}
|
||||
else {
|
||||
updatedData.EndpointSpec.Ports.push({
|
||||
Protocol: 'tcp',
|
||||
TargetPort: p.containerPort,
|
||||
PublishedPort: p.hostPort
|
||||
});
|
||||
updatedData.EndpointSpec.Ports.push({
|
||||
Protocol: 'udp',
|
||||
TargetPort: p.containerPort,
|
||||
PublishedPort: p.hostPort
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ class DockerRegistry {
|
||||
function createRegistryServiceOnNode() {
|
||||
|
||||
return dockerApi.createServiceOnNodeId(CaptainConstants.registryImageName, CaptainConstants.registryServiceName, [{
|
||||
protocol: 'tcp',
|
||||
containerPort: 5000,
|
||||
hostPort: CaptainConstants.registrySubDomainPort
|
||||
}], myNodeId, [
|
||||
|
||||
@@ -307,9 +307,11 @@ class LoadBalancerManager {
|
||||
Logger.d('No Captain Nginx service is running. Creating one on captain node...');
|
||||
|
||||
return dockerApi.createServiceOnNodeId(CaptainConstants.nginxImageName, CaptainConstants.nginxServiceName, [{
|
||||
protocol: 'tcp',
|
||||
containerPort: 80,
|
||||
hostPort: CaptainConstants.nginxPortNumber
|
||||
}, {
|
||||
protocol: 'tcp',
|
||||
containerPort: 443,
|
||||
hostPort: 443
|
||||
}], nodeId, null, null, {
|
||||
|
||||
@@ -113,6 +113,7 @@ module.exports.install = function () {
|
||||
}
|
||||
|
||||
ports.push({
|
||||
protocol: 'tcp',
|
||||
containerPort: CaptainConstants.captainServiceExposedPort,
|
||||
hostPort: CaptainConstants.captainServiceExposedPort
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user