Merge branch 'beta' into c-lightning

This commit is contained in:
AaronDewes 2022-05-01 18:17:48 +00:00
commit 969d4e7796
4 changed files with 14 additions and 3 deletions

View File

@ -104,6 +104,10 @@ properties:
type: array
items:
type: number
requiredUdpPorts:
type: array
items:
type: number
description: Ports this container requires to be exposed to work properly
port:
type: number

View File

@ -86,6 +86,10 @@ def createComposeConfigFromV3(app: dict, nodeRoot: str):
for container in newApp.containers:
container.ports = container.requiredPorts
del container.requiredPorts
for container in newApp.containers:
for udpPort in container.requiredUdpPorts:
container.ports.append(udpPort)
del container.requiredUdpPorts
newApp = configureMainPort(newApp, nodeRoot)
for container in newApp.containers:
# TODO: Make this dynamic and not hardcoded

View File

@ -37,6 +37,7 @@ class Container:
permissions: list = field(default_factory=list)
port: Union[int, None] = None
requiredPorts: list = field(default_factory=list)
requiredUdpPorts: list = field(default_factory=list)
preferredOutsidePort: Union[int, None] = None
requiresPort: Union[bool, None] = None
environment: Union[dict, None] = None

View File

@ -149,9 +149,11 @@ def getPortsV3App(app, appId):
validatePort(appContainer, appContainer["preferredOutsidePort"], appId, 1)
else:
validatePort(appContainer, appContainer["port"], appId, 0)
elif "requiredPorts" not in appContainer:
elif "requiredPorts" not in appContainer and "requiredUdpPorts" not in appContainer:
validatePort(appContainer, getNewPort(appPorts.keys()), appId, 0, True)
if "requiredPorts" in appContainer:
for port in appContainer["requiredPorts"]:
realPort = int(str(port).split(":")[0])
validatePort(appContainer, realPort, appId, 2)
validatePort(appContainer, port, appId, 2)
if "requiredUdpPorts" in appContainer:
for port in appContainer["requiredUdpPorts"]:
validatePort(appContainer, port, appId, 2)