mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Add DNS, DNSOption and DNSSearch to quadlet pod
Signed-off-by: Steve Jibson <steve@jibson.com>
This commit is contained in:
@ -892,7 +892,10 @@ Valid options for `[Pod]` are listed below:
|
||||
|-------------------------------------|----------------------------------------|
|
||||
| AddHost=hostname:192.168.10.11 | --add-host=hostname:192.168.10.11 |
|
||||
| ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf |
|
||||
| GIDMap=0:10000:10 | --gidmap=0:10000:10 |
|
||||
| DNS=192.168.55.1 | --dns=192.168.55.1 |
|
||||
| DNSOption=ndots:1 | --dns-option=ndots:1 |
|
||||
| DNSSearch=foo.com | --dns-search=foo.com |
|
||||
| GIDMap=0:10000:10 | --gidmap=0:10000:10 |
|
||||
| GlobalArgs=--log-level=debug | --log-level=debug |
|
||||
| IP=192.5.0.1 | --ip 192.5.0.1 |
|
||||
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
|
||||
@ -924,6 +927,24 @@ Load the specified containers.conf(5) module. Equivalent to the Podman `--module
|
||||
|
||||
This key can be listed multiple times.
|
||||
|
||||
### `DNS=`
|
||||
|
||||
Set network-scoped DNS resolver/nameserver for containers in this pod.
|
||||
|
||||
This key can be listed multiple times.
|
||||
|
||||
### `DNSOption=`
|
||||
|
||||
Set custom DNS options.
|
||||
|
||||
This key can be listed multiple times.
|
||||
|
||||
### `DNSSearch=`
|
||||
|
||||
Set custom DNS search domains. Use **DNSSearch=.** to remove the search domain.
|
||||
|
||||
This key can be listed multiple times.
|
||||
|
||||
### `GIDMap=`
|
||||
|
||||
Create the pod in a new user namespace using the supplied GID mapping.
|
||||
|
@ -385,6 +385,9 @@ var (
|
||||
supportedPodKeys = map[string]bool{
|
||||
KeyAddHost: true,
|
||||
KeyContainersConfModule: true,
|
||||
KeyDNS: true,
|
||||
KeyDNSOption: true,
|
||||
KeyDNSSearch: true,
|
||||
KeyGIDMap: true,
|
||||
KeyGlobalArgs: true,
|
||||
KeyIP: true,
|
||||
@ -1700,6 +1703,21 @@ func ConvertPod(podUnit *parser.UnitFile, name string, unitsInfoMap map[string]*
|
||||
execStartPre.addf("--infra-name=%s-infra", podName)
|
||||
execStartPre.addf("--name=%s", podName)
|
||||
|
||||
dns := podUnit.LookupAll(PodGroup, KeyDNS)
|
||||
for _, ipAddr := range dns {
|
||||
execStartPre.addf("--dns=%s", ipAddr)
|
||||
}
|
||||
|
||||
dnsOptions := podUnit.LookupAll(PodGroup, KeyDNSOption)
|
||||
for _, dnsOption := range dnsOptions {
|
||||
execStartPre.addf("--dns-option=%s", dnsOption)
|
||||
}
|
||||
|
||||
dnsSearches := podUnit.LookupAll(PodGroup, KeyDNSSearch)
|
||||
for _, dnsSearch := range dnsSearches {
|
||||
execStartPre.addf("--dns-search=%s", dnsSearch)
|
||||
}
|
||||
|
||||
ip, ok := podUnit.Lookup(PodGroup, KeyIP)
|
||||
if ok && len(ip) > 0 {
|
||||
execStartPre.addf("--ip=%s", ip)
|
||||
|
6
test/e2e/quadlet/dns-option.pod
Normal file
6
test/e2e/quadlet/dns-option.pod
Normal file
@ -0,0 +1,6 @@
|
||||
## assert-podman-pre-args "--dns-option=ndots:1"
|
||||
## assert-podman-pre-args "--dns-option=color:blue"
|
||||
|
||||
[Pod]
|
||||
DNSOption=ndots:1
|
||||
DNSOption=color:blue
|
6
test/e2e/quadlet/dns-search.pod
Normal file
6
test/e2e/quadlet/dns-search.pod
Normal file
@ -0,0 +1,6 @@
|
||||
## assert-podman-pre-args "--dns-search=foo.com"
|
||||
## assert-podman-pre-args "--dns-search=bar.com"
|
||||
|
||||
[Pod]
|
||||
DNSSearch=foo.com
|
||||
DNSSearch=bar.com
|
6
test/e2e/quadlet/dns.pod
Normal file
6
test/e2e/quadlet/dns.pod
Normal file
@ -0,0 +1,6 @@
|
||||
## assert-podman-pre-args "--dns=8.7.7.7"
|
||||
## assert-podman-pre-args "--dns=8.8.8.8"
|
||||
|
||||
[Pod]
|
||||
DNS=8.7.7.7
|
||||
DNS=8.8.8.8
|
@ -1002,6 +1002,9 @@ BOGUS=foo
|
||||
Entry("Build - Variant Key", "variant.build"),
|
||||
|
||||
Entry("Pod - Basic", "basic.pod"),
|
||||
Entry("Pod - DNS", "dns.pod"),
|
||||
Entry("Pod - DNS Option", "dns-option.pod"),
|
||||
Entry("Pod - DNS Search", "dns-search.pod"),
|
||||
Entry("Pod - Host", "host.pod"),
|
||||
Entry("Pod - IP", "ip.pod"),
|
||||
Entry("Pod - Name", "name.pod"),
|
||||
|
Reference in New Issue
Block a user