mirror of
https://github.com/containers/podman.git
synced 2025-08-16 20:53:13 +08:00
enable dnsplugin for network create
when users create a new network and the dnsname plugin can be found by podman, we will enable container name resolution on the new network. there is an option to opt *out* as well. tests cannot be added until we solve the packaging portion of the dnsname plugin. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -2,6 +2,8 @@ package network
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// NcList describes a generic map
|
||||
@ -111,3 +113,22 @@ func NewFirewallPlugin() FirewallConfig {
|
||||
Backend: "iptables",
|
||||
}
|
||||
}
|
||||
|
||||
// NewDNSNamePlugin creates the dnsname config with a given
|
||||
// domainname
|
||||
func NewDNSNamePlugin(domainName string) DNSNameConfig {
|
||||
return DNSNameConfig{
|
||||
PluginType: "dnsname",
|
||||
DomainName: domainName,
|
||||
}
|
||||
}
|
||||
|
||||
// HasDNSNamePlugin looks to see if the dnsname cni plugin is present
|
||||
func HasDNSNamePlugin(paths []string) bool {
|
||||
for _, p := range paths {
|
||||
if _, err := os.Stat(filepath.Join(p, "dnsname")); err == nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user