mirror of
https://github.com/runcitadel/core.git
synced 2024-12-27 07:05:05 +00:00
Add support for udpPorts
This commit is contained in:
parent
eaab1715e0
commit
3cc9b69fca
|
@ -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
|
||||
|
|
|
@ -79,6 +79,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue
Block a user