Merge pull request #45329 from supereagle/remove-useless-code

Automatic merge from submit-queue

remove useless code in kubelet

**What this PR does / why we need it**:
This code has logical error as the etc-hosts file will be recreated even it already exists. In addition, if do not recreate etc-hosts file when it exists, the pod ip in it will be out of date when pod ips change. So remove this code as it is not needed.

**Which issue this PR fixes**: 

**Special notes for your reviewer**:
xrefer: #44481, #44473

**Release note**:
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-05-04 09:06:33 -07:00 committed by GitHub
commit d41b11b8fb
1 changed files with 0 additions and 4 deletions

View File

@ -210,10 +210,6 @@ func makeHostsMount(podDir, podIP, hostName, hostDomainName string, hostAliases
// ensureHostsFile ensures that the given host file has an up-to-date ip, host // ensureHostsFile ensures that the given host file has an up-to-date ip, host
// name, and domain name. // name, and domain name.
func ensureHostsFile(fileName, hostIP, hostName, hostDomainName string, hostAliases []v1.HostAlias) error { func ensureHostsFile(fileName, hostIP, hostName, hostDomainName string, hostAliases []v1.HostAlias) error {
if _, err := os.Stat(fileName); os.IsExist(err) {
glog.V(4).Infof("kubernetes-managed etc-hosts file exits. Will not be recreated: %q", fileName)
return nil
}
content := hostsFileContent(hostIP, hostName, hostDomainName, hostAliases) content := hostsFileContent(hostIP, hostName, hostDomainName, hostAliases)
return ioutil.WriteFile(fileName, content, 0644) return ioutil.WriteFile(fileName, content, 0644)
} }