mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 02:56:31 +00:00
Merge 2470d16d85fe2643a050927aec2a125ad6e5ef50 into ad5827d33fcdb448b156edbd492c482df90c2930
This commit is contained in:
commit
bd77b12d06
@ -43,6 +43,7 @@ SYSTEMD_JOURNAL_VOLATILE = Path("/run/log/journal")
|
|||||||
DOCKER_NETWORK = "hassio"
|
DOCKER_NETWORK = "hassio"
|
||||||
DOCKER_NETWORK_MASK = ip_network("172.30.32.0/23")
|
DOCKER_NETWORK_MASK = ip_network("172.30.32.0/23")
|
||||||
DOCKER_NETWORK_RANGE = ip_network("172.30.33.0/24")
|
DOCKER_NETWORK_RANGE = ip_network("172.30.33.0/24")
|
||||||
|
DOCKER_NETWORK_ULA = ip_network("fd00:172:30:32::/64")
|
||||||
|
|
||||||
# This needs to match the dockerd --cpu-rt-runtime= argument.
|
# This needs to match the dockerd --cpu-rt-runtime= argument.
|
||||||
DOCKER_CPU_RUNTIME_TOTAL = 950_000
|
DOCKER_CPU_RUNTIME_TOTAL = 950_000
|
||||||
|
@ -7,7 +7,12 @@ import logging
|
|||||||
import docker
|
import docker
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from ..const import DOCKER_NETWORK, DOCKER_NETWORK_MASK, DOCKER_NETWORK_RANGE
|
from ..const import (
|
||||||
|
DOCKER_NETWORK,
|
||||||
|
DOCKER_NETWORK_MASK,
|
||||||
|
DOCKER_NETWORK_RANGE,
|
||||||
|
DOCKER_NETWORK_ULA,
|
||||||
|
)
|
||||||
from ..exceptions import DockerError
|
from ..exceptions import DockerError
|
||||||
|
|
||||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||||
@ -76,19 +81,25 @@ class DockerNetwork:
|
|||||||
except docker.errors.NotFound:
|
except docker.errors.NotFound:
|
||||||
_LOGGER.info("Can't find Supervisor network, creating a new network")
|
_LOGGER.info("Can't find Supervisor network, creating a new network")
|
||||||
|
|
||||||
ipam_pool = docker.types.IPAMPool(
|
# IP configuration
|
||||||
|
ipam_pool_v4 = docker.types.IPAMPool(
|
||||||
subnet=str(DOCKER_NETWORK_MASK),
|
subnet=str(DOCKER_NETWORK_MASK),
|
||||||
gateway=str(self.gateway),
|
gateway=str(self.gateway),
|
||||||
iprange=str(DOCKER_NETWORK_RANGE),
|
iprange=str(DOCKER_NETWORK_RANGE),
|
||||||
)
|
)
|
||||||
|
ipam_pool_v6 = docker.types.IPAMPool(
|
||||||
|
subnet=str(DOCKER_NETWORK_ULA),
|
||||||
|
gateway=str(DOCKER_NETWORK_ULA[1]),
|
||||||
|
)
|
||||||
|
|
||||||
ipam_config = docker.types.IPAMConfig(pool_configs=[ipam_pool])
|
ipam_config = docker.types.IPAMConfig(pool_configs=[ipam_pool_v4, ipam_pool_v6])
|
||||||
|
|
||||||
|
# Create Network
|
||||||
return self.docker.networks.create(
|
return self.docker.networks.create(
|
||||||
DOCKER_NETWORK,
|
DOCKER_NETWORK,
|
||||||
driver="bridge",
|
driver="bridge",
|
||||||
ipam=ipam_config,
|
ipam=ipam_config,
|
||||||
enable_ipv6=False,
|
enable_ipv6=True,
|
||||||
options={"com.docker.network.bridge.name": DOCKER_NETWORK},
|
options={"com.docker.network.bridge.name": DOCKER_NETWORK},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user