Skip to content

Commit

Permalink
Retrieve host IP in isolation from apiserver
Browse files Browse the repository at this point in the history
Cherry-pick of: kubernetes#27508
  • Loading branch information
aaronlevy committed Jun 16, 2016
1 parent cc42aac commit a806b35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,7 @@ func (kl *Kubelet) generateAPIPodStatus(pod *api.Pod, podStatus *kubecontainer.P
})

if !kl.standaloneMode {
hostIP, err := kl.GetHostIP()
hostIP, err := kl.getHostIPAnyWay()
if err != nil {
glog.V(4).Infof("Cannot get host IP: %v", err)
} else {
Expand Down
9 changes: 9 additions & 0 deletions pkg/kubelet/kubelet_getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ func (kl *Kubelet) GetHostIP() (net.IP, error) {
}
return nodeutil.GetNodeHostIP(node)
}

// getHostIPAnyway attempts to return the host IP from kubelet's nodeInfo, or the initialNodeStatus
func (kl *Kubelet) getHostIPAnyWay() (net.IP, error) {
node, err := kl.getNodeAnyWay()
if err != nil {
return nil, err
}
return nodeutil.GetNodeHostIP(node)
}

0 comments on commit a806b35

Please sign in to comment.