Merge pull request #41243 from shashidharatd/kubefed-1

Automatic merge from submit-queue (batch tested with PRs 40297, 41285, 41211, 41243, 39735)

Add LegacyHostIP as a fallback to federation api-server nodeport service

**What this PR does / why we need it**:
while deploying federation using kubefed and using NodePort type service for api-server, if the cluster does not have NodeExternalIP for nodes, then it leads to incorrect endpoint being written to kubeconfig.
So falling back to use LegacyHostIP in such cases.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
Partly fixes an issue in this [thread](https://github.com/kubernetes/kubernetes/issues/41127#issuecomment-278888658)

**Special notes for your reviewer**:

**Release note**:
`NONE`

```release-note
```
cc @kubernetes/sig-federation-bugs @madhusudancs
This commit is contained in:
Kubernetes Submit Queue 2017-02-15 03:25:13 -08:00 committed by GitHub
commit 6f59c752c8

View File

@ -409,6 +409,7 @@ func createService(clientset *client.Clientset, namespace, svcName, apiserverAdv
func getClusterNodeIPs(clientset *client.Clientset) ([]string, error) {
preferredAddressTypes := []api.NodeAddressType{
api.NodeExternalIP,
api.NodeLegacyHostIP,
}
nodeList, err := clientset.Nodes().List(metav1.ListOptions{})
if err != nil {