summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/namespaces.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-21 05:09:54 -0400
committerGitHub <noreply@github.com>2020-04-21 05:09:54 -0400
commit8884f6a4f357ea64ad5f20f791ec0a09bdd36352 (patch)
treea53c1994b7746b461a93b8ced9cb6157b249567b /pkg/specgen/generate/namespaces.go
parent90636fe8c2d1eb5ae75afa73405c8b12a0417fca (diff)
parent426eccee63fc7add4b37a9c246cf83b08379cb62 (diff)
downloadpodman-8884f6a4f357ea64ad5f20f791ec0a09bdd36352.tar.gz
podman-8884f6a4f357ea64ad5f20f791ec0a09bdd36352.tar.bz2
podman-8884f6a4f357ea64ad5f20f791ec0a09bdd36352.zip
Merge pull request #5875 from rhatdan/network
Cleanup network option parsing
Diffstat (limited to 'pkg/specgen/generate/namespaces.go')
-rw-r--r--pkg/specgen/generate/namespaces.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go
index 53ae335c3..16a1c048f 100644
--- a/pkg/specgen/generate/namespaces.go
+++ b/pkg/specgen/generate/namespaces.go
@@ -145,20 +145,19 @@ func GenerateNamespaceContainerOpts(s *specgen.SpecGenerator, rt *libpod.Runtime
if len(s.DNSSearch) > 0 {
options = append(options, libpod.WithDNSSearch(s.DNSSearch))
}
- if len(s.DNSServer) > 0 {
- // TODO I'm not sure how we are going to handle this given the input
- if len(s.DNSServer) == 1 { //&& strings.ToLower(s.DNSServer[0].) == "none" {
- options = append(options, libpod.WithUseImageResolvConf())
- } else {
- var dnsServers []string
- for _, d := range s.DNSServer {
- dnsServers = append(dnsServers, d.String())
- }
- options = append(options, libpod.WithDNS(dnsServers))
+
+ if s.UseImageResolvConf {
+ options = append(options, libpod.WithUseImageResolvConf())
+ } else {
+ var dnsServers []string
+ for _, d := range s.DNSServers {
+ dnsServers = append(dnsServers, d.String())
}
+ options = append(options, libpod.WithDNS(dnsServers))
}
- if len(s.DNSOption) > 0 {
- options = append(options, libpod.WithDNSOption(s.DNSOption))
+
+ if len(s.DNSOptions) > 0 {
+ options = append(options, libpod.WithDNSOption(s.DNSOptions))
}
if s.StaticIP != nil {
options = append(options, libpod.WithStaticIP(*s.StaticIP))