Skip to content

Commit

Permalink
Merge pull request kubernetes#20 from wlan0/v1.2.4-rancher
Browse files Browse the repository at this point in the history
add host network ip address to cache
  • Loading branch information
ibuildthecloud authored Jun 16, 2016
2 parents 50663df + 072e55b commit 7a5db28
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/kubelet/dockertools/rancher_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func (r *RancherDockerClient) getIp(container *docker.Container) (string, error)

rancherContainer := containers.Data[0]

ipAddr := ""

// If the hostNetwork for the pod is set to true
if rancherContainer.NetworkMode == "host" {
hosts := &rancher.HostCollection{}
Expand All @@ -124,14 +126,14 @@ func (r *RancherDockerClient) getIp(container *docker.Container) (string, error)
if len(ipAddresses.Data) == 0 {
return "", nil
}
return ipAddresses.Data[0].Address, nil
ipAddr = ipAddresses.Data[0].Address
} else if rancherContainer.PrimaryIpAddress != "" {
ipAddr = rancherContainer.PrimaryIpAddress
}

if rancherContainer.PrimaryIpAddress != "" {
glog.Infof("Found IP %s for container %s", rancherContainer.PrimaryIpAddress, container.ID)
r.cache.Add(container.ID, rancherContainer.PrimaryIpAddress)
}
return rancherContainer.PrimaryIpAddress, nil
glog.Infof("Found IP %s for container %s", ipAddr, container.ID)
r.cache.Add(container.ID, ipAddr)
return ipAddr, nil
}

func (r *RancherDockerClient) setIp(container *docker.Container) (bool, error) {
Expand Down

0 comments on commit 7a5db28

Please sign in to comment.