diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 3ac3537c..9bbe4474 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -368,7 +368,7 @@ }, { "ImportPath": "github.com/rancher/netconf", - "Rev": "b9aeb623c8ef9551d79efec57ee059658c1ac89c" + "Rev": "02925e7cf5a0f0bb0aa5360ee260ef7378e5eff8" }, { "ImportPath": "github.com/ryanuber/go-glob", diff --git a/Godeps/_workspace/src/github.com/rancher/netconf/types.go b/Godeps/_workspace/src/github.com/rancher/netconf/types.go index b278f493..e07d2cd9 100644 --- a/Godeps/_workspace/src/github.com/rancher/netconf/types.go +++ b/Godeps/_workspace/src/github.com/rancher/netconf/types.go @@ -16,6 +16,7 @@ type InterfaceConfig struct { } type DnsConfig struct { + Override bool `yaml:"override"` Nameservers []string `yaml:"nameservers,flow,omitempty"` Search []string `yaml:"search,flow,omitempty"` } diff --git a/cmd/network/network.go b/cmd/network/network.go index 5bb6c57c..2c95a879 100644 --- a/cmd/network/network.go +++ b/cmd/network/network.go @@ -7,6 +7,7 @@ import ( log "github.com/Sirupsen/logrus" + "github.com/docker/libnetwork/resolvconf" "github.com/rancher/netconf" "github.com/rancher/os/cmd/cloudinit" "github.com/rancher/os/config" @@ -37,7 +38,13 @@ func Main() { } cloudinit.SetHostname(cfg) // ignore error if err := netconf.ApplyNetworkConfigs(&cfg.Rancher.Network); err != nil { - log.Fatal(err) + log.Error(err) + } + if cfg.Rancher.Network.Dns.Override { + log.WithFields(log.Fields{"nameservers": cfg.Rancher.Network.Dns.Nameservers}).Info("Override nameservers") + if err := resolvconf.Build("/etc/resolv.conf", cfg.Rancher.Network.Dns.Nameservers, cfg.Rancher.Network.Dns.Search); err != nil { + log.Error(err) + } } if _, err := os.Create(NETWORK_DONE); err != nil { log.Error(err) diff --git a/os-config.yml b/os-config.yml index 22525b1d..538616b9 100644 --- a/os-config.yml +++ b/os-config.yml @@ -244,6 +244,7 @@ rancher: volumes: - /dev:/host/dev - /etc/docker:/etc/docker + - /etc/resolv.conf:/etc/resolv.conf - /etc/rkt:/etc/rkt - /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt.rancher - /lib/firmware:/lib/firmware