outposts: allow custom label for docker containers
closes #2128 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
82cc1d536a
commit
42f5cf8c93
|
@ -106,9 +106,12 @@ class DockerController(BaseController):
|
||||||
).lower()
|
).lower()
|
||||||
|
|
||||||
def _get_labels(self) -> dict[str, str]:
|
def _get_labels(self) -> dict[str, str]:
|
||||||
return {
|
labels = {
|
||||||
"io.goauthentik.outpost-uuid": self.outpost.pk.hex,
|
"io.goauthentik.outpost-uuid": self.outpost.pk.hex,
|
||||||
}
|
}
|
||||||
|
if self.outpost.config.docker_labels:
|
||||||
|
labels.update(self.outpost.config.docker_labels)
|
||||||
|
return labels
|
||||||
|
|
||||||
def _get_env(self) -> dict[str, str]:
|
def _get_env(self) -> dict[str, str]:
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -60,6 +60,7 @@ class OutpostConfig:
|
||||||
|
|
||||||
docker_network: Optional[str] = field(default=None)
|
docker_network: Optional[str] = field(default=None)
|
||||||
docker_map_ports: bool = field(default=True)
|
docker_map_ports: bool = field(default=True)
|
||||||
|
docker_labels: Optional[dict[str, str]] = field(default=None)
|
||||||
|
|
||||||
container_image: Optional[str] = field(default=None)
|
container_image: Optional[str] = field(default=None)
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,9 @@ docker_network: null
|
||||||
# Optionally disable mapping of ports to outpost container, may be useful when using docker networks
|
# Optionally disable mapping of ports to outpost container, may be useful when using docker networks
|
||||||
# (Available with 2021.9.4+)
|
# (Available with 2021.9.4+)
|
||||||
docker_map_ports: true
|
docker_map_ports: true
|
||||||
|
# Optionally additional labels for docker containers
|
||||||
|
# (Available with 2022.1.2)
|
||||||
|
docker_labels: null
|
||||||
########################################
|
########################################
|
||||||
# Kubernetes outpost specific settings
|
# Kubernetes outpost specific settings
|
||||||
########################################
|
########################################
|
||||||
|
|
|
@ -12,6 +12,7 @@ The following outpost settings are used:
|
||||||
- `container_image`: Optionally overwrites the standard container image (see [Configuration](../../installation/configuration.md) to configure the global default)
|
- `container_image`: Optionally overwrites the standard container image (see [Configuration](../../installation/configuration.md) to configure the global default)
|
||||||
- `docker_network`: The docker network the container should be added to. This needs to be modified if you plan to connect to authentik using the internal hostname.
|
- `docker_network`: The docker network the container should be added to. This needs to be modified if you plan to connect to authentik using the internal hostname.
|
||||||
- `docker_map_ports`: Enable/disable the mapping of ports. When using a proxy outpost with traefik for example, you might not want to bind ports as they are routed through traefik.
|
- `docker_map_ports`: Enable/disable the mapping of ports. When using a proxy outpost with traefik for example, you might not want to bind ports as they are routed through traefik.
|
||||||
|
- `docker_labels`: Optional additional labels that can be applied to the container.
|
||||||
|
|
||||||
The container is created with the following hardcoded properties:
|
The container is created with the following hardcoded properties:
|
||||||
|
|
||||||
|
|
Reference in New Issue