outposts: allow disabling of docker controller port mapping
closes #1474 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
339eaf37f2
commit
10b45d954e
|
@ -99,15 +99,16 @@ class DockerController(BaseController):
|
||||||
"image": image_name,
|
"image": image_name,
|
||||||
"name": container_name,
|
"name": container_name,
|
||||||
"detach": True,
|
"detach": True,
|
||||||
"ports": {
|
|
||||||
f"{port.inner_port or port.port}/{port.protocol.lower()}": port.port
|
|
||||||
for port in self.deployment_ports
|
|
||||||
},
|
|
||||||
"environment": self._get_env(),
|
"environment": self._get_env(),
|
||||||
"labels": self._get_labels(),
|
"labels": self._get_labels(),
|
||||||
"restart_policy": {"Name": "unless-stopped"},
|
"restart_policy": {"Name": "unless-stopped"},
|
||||||
"network": self.outpost.config.docker_network,
|
"network": self.outpost.config.docker_network,
|
||||||
}
|
}
|
||||||
|
if self.outpost.config.docker_map_ports:
|
||||||
|
container_args["ports"] = {
|
||||||
|
f"{port.inner_port or port.port}/{port.protocol.lower()}": str(port.port)
|
||||||
|
for port in self.deployment_ports
|
||||||
|
}
|
||||||
if settings.TEST:
|
if settings.TEST:
|
||||||
del container_args["ports"]
|
del container_args["ports"]
|
||||||
del container_args["network"]
|
del container_args["network"]
|
||||||
|
|
|
@ -72,6 +72,7 @@ class OutpostConfig:
|
||||||
object_naming_template: str = field(default="ak-outpost-%(name)s")
|
object_naming_template: str = field(default="ak-outpost-%(name)s")
|
||||||
|
|
||||||
docker_network: Optional[str] = field(default=None)
|
docker_network: Optional[str] = field(default=None)
|
||||||
|
docker_map_ports: bool = field(default=True)
|
||||||
|
|
||||||
kubernetes_replicas: int = field(default=1)
|
kubernetes_replicas: int = field(default=1)
|
||||||
kubernetes_namespace: str = field(default_factory=get_namespace)
|
kubernetes_namespace: str = field(default_factory=get_namespace)
|
||||||
|
|
|
@ -46,6 +46,9 @@ object_naming_template: ak-outpost-%(name)s
|
||||||
########################################
|
########################################
|
||||||
# Network the outpost container should be connected to
|
# Network the outpost container should be connected to
|
||||||
docker_network: null
|
docker_network: null
|
||||||
|
# Optionally disable mapping of ports to outpost container, may be useful when using docker networks
|
||||||
|
# (Available with 2021.9.4+)
|
||||||
|
docker_map_ports: true
|
||||||
########################################
|
########################################
|
||||||
# Kubernetes outpost specific settings
|
# Kubernetes outpost specific settings
|
||||||
########################################
|
########################################
|
||||||
|
|
Reference in New Issue