Pass the WeaveDNS Domain into the proxy

instead of obtaining it via the http api
This commit is contained in:
Bryan Boreham committed 2018-01-29 15:55:36 +00:00
1 parent 86d2800b59
commit e7f30106c0
4 files changed
+7 -13

No files matched your search

+3 -3
View File
@@ -68,11 +68,11 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
if err != nil {
return err
}
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
if err := i.setHostname(container, hostname, dnsDomain); err != nil {
if !i.proxy.WithoutDNS {
if err := i.setHostname(container, hostname, i.proxy.DNSDomain); err != nil {
return err
}
if err := i.proxy.setWeaveDNS(hostConfig, hostname, dnsDomain); err != nil {
if err := i.proxy.setWeaveDNS(hostConfig, hostname, i.proxy.DNSDomain); err != nil {
return err
}
}
+1 -8
View File
@@ -62,6 +62,7 @@ type Config struct {
TLSConfig TLSConfig
WithoutDNS bool
DNSListenAddress string
DNSDomain string
NoMulticastRoute bool
KeepTXOn bool
DockerBridge string
@@ -603,14 +604,6 @@ func (proxy *Proxy) setWeaveDNS(hostConfig jsonObject, hostname, dnsDomain strin
return nil
}
func (proxy *Proxy) getDNSDomain() string {
if proxy.WithoutDNS {
return ""
}
domain, _ := proxy.weave.DNSDomain()
return domain
}
func (proxy *Proxy) updateContainerNetworkSettings(container jsonObject) error {
containerID, err := container.String("Id")
if err != nil {
+2 -2
View File
@@ -50,8 +50,8 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
return err
}
}
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
if !i.proxy.WithoutDNS {
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, i.proxy.DNSDomain); err != nil {
return err
}
}