diff options
author | baude <bbaude@redhat.com> | 2019-10-03 15:22:40 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-10-28 12:52:30 -0500 |
commit | 2f6b8b94e87bb3645d34e59dd3b748dba4aa4d2c (patch) | |
tree | 5bf28fa1f061cb8193dc4e88e6c4e0144bd29e28 /pkg/adapter/network.go | |
parent | ac73fd3fe5dcbf2647d589f9c9f37fe9531ed663 (diff) | |
download | podman-2f6b8b94e87bb3645d34e59dd3b748dba4aa4d2c.tar.gz podman-2f6b8b94e87bb3645d34e59dd3b748dba4aa4d2c.tar.bz2 podman-2f6b8b94e87bb3645d34e59dd3b748dba4aa4d2c.zip |
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>
Diffstat (limited to 'pkg/adapter/network.go')
-rw-r--r-- | pkg/adapter/network.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pkg/adapter/network.go b/pkg/adapter/network.go index d407984ce..9659ae339 100644 --- a/pkg/adapter/network.go +++ b/pkg/adapter/network.go @@ -155,15 +155,14 @@ func (r *LocalRuntime) removeNetwork(ctx context.Context, name string, container // NetworkCreate creates a CNI network func (r *LocalRuntime) NetworkCreate(cli *cliconfig.NetworkCreateValues) (string, error) { - var ( - err error - ) - isGateway := true ipMasq := true subnet := &cli.Network ipRange := cli.IPRange - + runtimeConfig, err := r.GetConfig() + if err != nil { + return "", err + } // if range is provided, make sure it is "in" network if cli.IsSet("subnet") { // if network is provided, does it conflict with existing CNI or live networks @@ -245,6 +244,11 @@ func (r *LocalRuntime) NetworkCreate(cli *cliconfig.NetworkCreateValues) (string plugins = append(plugins, bridge) plugins = append(plugins, network.NewPortMapPlugin()) plugins = append(plugins, network.NewFirewallPlugin()) + // if we find the dnsname plugin, we add configuration for it + if network.HasDNSNamePlugin(runtimeConfig.CNIPluginDir) && !cli.DisableDNS { + // Note: in the future we might like to allow for dynamic domain names + plugins = append(plugins, network.NewDNSNamePlugin(network.DefaultPodmanDomainName)) + } ncList["plugins"] = plugins b, err := json.MarshalIndent(ncList, "", " ") if err != nil { |