mirror of
https://github.com/containers/podman-compose.git
synced 2025-02-05 04:49:27 +01:00
Add network "disable-dns" support
Podman allows to create a network disabling the DNS plugin with '--disable-dns', but this option is not available in the compose spec. This patch add 'x-podman.disable-dns' to the podman-compose options, allowing the creation of a network with the DNS plugin disabled. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
This commit is contained in:
parent
84f1fbd622
commit
6e642dca1f
@ -27,6 +27,14 @@ services:
|
||||
|
||||
For explanations of these extensions, please refer to the [Podman Documentation](https://docs.podman.io/).
|
||||
|
||||
## Network management
|
||||
|
||||
The following extension keys are available under network configuration:
|
||||
|
||||
* `x-podman.disable-dns` - Disable the DNS plugin for the network when set to 'true'.
|
||||
|
||||
For explanations of these extensions, please refer to the
|
||||
[Podman network create command Documentation](https://docs.podman.io/en/latest/markdown/podman-network-create.1.html).
|
||||
|
||||
## Per-network MAC-addresses
|
||||
|
||||
|
1
newsfragments/x-podman.disable-dns.feature
Normal file
1
newsfragments/x-podman.disable-dns.feature
Normal file
@ -0,0 +1 @@
|
||||
- Add support for 'x-podman.disable-dns' to allow disabling DNS plugin on defined networks.
|
@ -833,6 +833,8 @@ def get_network_create_args(net_desc, proj_name, net_name):
|
||||
ipam_config_ls = ipam.get("config", [])
|
||||
if net_desc.get("enable_ipv6"):
|
||||
args.append("--ipv6")
|
||||
if net_desc.get("x-podman.disable_dns"):
|
||||
args.append("--disable-dns")
|
||||
|
||||
if isinstance(ipam_config_ls, dict):
|
||||
ipam_config_ls = [ipam_config_ls]
|
||||
|
@ -201,3 +201,27 @@ class TestGetNetworkCreateArgs(unittest.TestCase):
|
||||
]
|
||||
args = get_network_create_args(net_desc, proj_name, net_name)
|
||||
self.assertEqual(args, expected_args)
|
||||
|
||||
def test_disable_dns(self):
|
||||
net_desc = {
|
||||
"labels": [],
|
||||
"internal": False,
|
||||
"driver": None,
|
||||
"driver_opts": {},
|
||||
"ipam": {"config": []},
|
||||
"enable_ipv6": False,
|
||||
"x-podman.disable_dns": True,
|
||||
}
|
||||
proj_name = "test_project"
|
||||
net_name = "test_network"
|
||||
expected_args = [
|
||||
"create",
|
||||
"--label",
|
||||
f"io.podman.compose.project={proj_name}",
|
||||
"--label",
|
||||
f"com.docker.compose.project={proj_name}",
|
||||
"--disable-dns",
|
||||
net_name,
|
||||
]
|
||||
args = get_network_create_args(net_desc, proj_name, net_name)
|
||||
self.assertEqual(args, expected_args)
|
||||
|
Loading…
Reference in New Issue
Block a user