mirror of https://github.com/k3s-io/k3s
Move auto-generated resolv.conf out of /tmp to prevent accidental cleanup
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>pull/5535/head
parent
a935a42031
commit
1d4f995edd
|
@ -20,6 +20,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/k3s-io/k3s/pkg/agent/proxy"
|
||||
agentutil "github.com/k3s-io/k3s/pkg/agent/util"
|
||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||
"github.com/k3s-io/k3s/pkg/clientaccess"
|
||||
"github.com/k3s-io/k3s/pkg/containerd"
|
||||
|
@ -306,12 +307,13 @@ func locateOrGenerateResolvConf(envInfo *cmds.Agent) string {
|
|||
}
|
||||
}
|
||||
|
||||
tmpConf := filepath.Join(os.TempDir(), version.Program+"-resolv.conf")
|
||||
if err := ioutil.WriteFile(tmpConf, []byte("nameserver 8.8.8.8\n"), 0444); err != nil {
|
||||
logrus.Errorf("Failed to write %s: %v", tmpConf, err)
|
||||
resolvConf := filepath.Join(envInfo.DataDir, "agent", "etc", "resolv.conf")
|
||||
if err := agentutil.WriteFile(resolvConf, "nameserver 8.8.8.8\n"); err != nil {
|
||||
logrus.Errorf("Failed to write %s: %v", resolvConf, err)
|
||||
return ""
|
||||
}
|
||||
return tmpConf
|
||||
logrus.Warnf("Host resolv.conf includes loopback or multicast nameservers - kubelet will use autogenerated resolv.conf with nameserver 8.8.8.8")
|
||||
return resolvConf
|
||||
}
|
||||
|
||||
func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
|
||||
|
|
Loading…
Reference in New Issue