mirror of
https://github.com/runcitadel/core.git
synced 2024-12-28 15:42:59 +00:00
Add support for udpPorts
This commit is contained in:
parent
eaab1715e0
commit
3cc9b69fca
|
@ -104,6 +104,10 @@ properties:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: number
|
type: number
|
||||||
|
requiredUdpPorts:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: number
|
||||||
description: Ports this container requires to be exposed to work properly
|
description: Ports this container requires to be exposed to work properly
|
||||||
port:
|
port:
|
||||||
type: number
|
type: number
|
||||||
|
|
|
@ -79,6 +79,10 @@ def createComposeConfigFromV3(app: dict, nodeRoot: str):
|
||||||
for container in newApp.containers:
|
for container in newApp.containers:
|
||||||
container.ports = container.requiredPorts
|
container.ports = container.requiredPorts
|
||||||
del 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)
|
newApp = configureMainPort(newApp, nodeRoot)
|
||||||
for container in newApp.containers:
|
for container in newApp.containers:
|
||||||
# TODO: Make this dynamic and not hardcoded
|
# TODO: Make this dynamic and not hardcoded
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Container:
|
||||||
permissions: list = field(default_factory=list)
|
permissions: list = field(default_factory=list)
|
||||||
port: Union[int, None] = None
|
port: Union[int, None] = None
|
||||||
requiredPorts: list = field(default_factory=list)
|
requiredPorts: list = field(default_factory=list)
|
||||||
|
requiredUdpPorts: list = field(default_factory=list)
|
||||||
preferredOutsidePort: Union[int, None] = None
|
preferredOutsidePort: Union[int, None] = None
|
||||||
requiresPort: Union[bool, None] = None
|
requiresPort: Union[bool, None] = None
|
||||||
environment: Union[dict, None] = None
|
environment: Union[dict, None] = None
|
||||||
|
|
|
@ -149,9 +149,11 @@ def getPortsV3App(app, appId):
|
||||||
validatePort(appContainer, appContainer["preferredOutsidePort"], appId, 1)
|
validatePort(appContainer, appContainer["preferredOutsidePort"], appId, 1)
|
||||||
else:
|
else:
|
||||||
validatePort(appContainer, appContainer["port"], appId, 0)
|
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)
|
validatePort(appContainer, getNewPort(appPorts.keys()), appId, 0, True)
|
||||||
if "requiredPorts" in appContainer:
|
if "requiredPorts" in appContainer:
|
||||||
for port in appContainer["requiredPorts"]:
|
for port in appContainer["requiredPorts"]:
|
||||||
realPort = int(str(port).split(":")[0])
|
validatePort(appContainer, port, appId, 2)
|
||||||
validatePort(appContainer, realPort, appId, 2)
|
if "requiredUdpPorts" in appContainer:
|
||||||
|
for port in appContainer["requiredUdpPorts"]:
|
||||||
|
validatePort(appContainer, port, appId, 2)
|
Loading…
Reference in New Issue
Block a user