[proxy] Add --without-dns flag, and change meaning of --with-dns flag
This commit is contained in:
1 parent
a1cb5b16a6
commit
8873d69b77
6 files changed
+58
-18
No files matched your search
@@ -81,7 +81,12 @@ func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Co
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) setWeaveDNS(container *createContainerRequestBody, r *http.Request) error {
|
||||
if !i.proxy.WithDNS {
|
||||
if i.proxy.WithoutDNS {
|
||||
return nil
|
||||
}
|
||||
|
||||
dnsDomain, dnsRunning := i.getDNSDomain()
|
||||
if !(dnsRunning || i.proxy.WithDNS) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -95,13 +100,13 @@ func (i *createContainerInterceptor) setWeaveDNS(container *createContainerReque
|
||||
if container.Hostname == "" && name != "" {
|
||||
container.Hostname = name
|
||||
// Strip trailing period because it's unusual to see it used on the end of a host name
|
||||
container.Domainname = strings.TrimSuffix(i.getDNSDomain(), ".")
|
||||
container.Domainname = strings.TrimSuffix(dnsDomain, ".")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) getDNSDomain() (domain string) {
|
||||
func (i *createContainerInterceptor) getDNSDomain() (domain string, running bool) {
|
||||
domain = nameserver.DefaultLocalDomain
|
||||
dnsContainer, err := i.proxy.client.InspectContainer("weavedns")
|
||||
if err != nil ||
|
||||
@@ -122,7 +127,7 @@ func (i *createContainerInterceptor) getDNSDomain() (domain string) {
|
||||
return
|
||||
}
|
||||
|
||||
return string(b)
|
||||
return string(b), true
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) InterceptResponse(r *http.Response) error {
|
||||
|
||||
Reference in new issue
Block a user