outposts: add configurable docker_network for outpost

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-27 19:10:30 +02:00
parent 3323b50036
commit dc41d0af27
3 changed files with 11 additions and 1 deletions

View File

@ -92,9 +92,11 @@ class DockerController(BaseController):
"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,
} }
if settings.TEST: if settings.TEST:
del container_args["ports"] del container_args["ports"]
del container_args["network"]
container_args["network_mode"] = "host" container_args["network_mode"] = "host"
return ( return (
self.client.containers.create(**container_args), self.client.containers.create(**container_args),

View File

@ -56,6 +56,7 @@ class ServiceConnectionInvalid(SentryIgnoredException):
@dataclass @dataclass
# pylint: disable=too-many-instance-attributes
class OutpostConfig: class OutpostConfig:
"""Configuration an outpost uses to configure it self""" """Configuration an outpost uses to configure it self"""
@ -67,8 +68,10 @@ class OutpostConfig:
log_level: str = CONFIG.y("log_level") log_level: str = CONFIG.y("log_level")
error_reporting_enabled: bool = CONFIG.y_bool("error_reporting.enabled") error_reporting_enabled: bool = CONFIG.y_bool("error_reporting.enabled")
error_reporting_environment: str = CONFIG.y("error_reporting.environment", "customer") error_reporting_environment: str = CONFIG.y("error_reporting.environment", "customer")
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)
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)
kubernetes_ingress_annotations: dict[str, str] = field(default_factory=dict) kubernetes_ingress_annotations: dict[str, str] = field(default_factory=dict)

View File

@ -42,6 +42,11 @@ object_naming_template: ak-outpost-%(name)s
######################################## ########################################
# Kubernetes outpost specific settings # Kubernetes outpost specific settings
######################################## ########################################
# Network the outpost container should be connected to
docker_network: null
########################################
# Kubernetes outpost specific settings
########################################
# Replica count for the deployment of the outpost # Replica count for the deployment of the outpost
kubernetes_replicas: 1 kubernetes_replicas: 1
# Namespace to deploy in, defaults to the same namespace authentik is deployed in (if available) # Namespace to deploy in, defaults to the same namespace authentik is deployed in (if available)