Add v1.NodeLegacyHostIP to be consistent with the internal API;

Mark NodeLegacyHostIP will be deprecated in 1.7;
Let cloudprovider that used to only set NodeLegacyHostIP set the IP as both InternalIP and ExternalIP, to allow dprecation in 1.7
This commit is contained in:
Chao Xu
2016-11-02 13:48:27 -07:00
parent 8e3909c32a
commit 783af943db
8 changed files with 29 additions and 48 deletions

View File

@@ -290,5 +290,9 @@ func (c *MesosCloud) NodeAddresses(nodeName types.NodeName) ([]api.NodeAddress,
if err != nil {
return nil, err
}
return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: ip.String()}}, nil
return []api.NodeAddress{
{Type: api.NodeLegacyHostIP, Address: ip.String()},
{Type: api.NodeInternalIP, Address: ip.String()},
{Type: api.NodeExternalIP, Address: ip.String()},
}, nil
}

View File

@@ -173,7 +173,11 @@ func (v *OVirtCloud) NodeAddresses(nodeName types.NodeName) ([]api.NodeAddress,
address = resolved[0]
}
return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: address.String()}}, nil
return []api.NodeAddress{
{Type: api.NodeLegacyHostIP, Address: address.String()},
{Type: api.NodeInternalIP, Address: address.String()},
{Type: api.NodeExternalIP, Address: address.String()},
}, nil
}
// mapNodeNameToInstanceName maps from a k8s NodeName to an ovirt instance name (the hostname)

View File

@@ -408,7 +408,12 @@ func (i *Instances) NodeAddresses(nodeName types.NodeName) ([]api.NodeAddress, e
glog.V(2).Infof("NodeAddresses(%v) => %v", serverName, ip)
// net.ParseIP().String() is to maintain compatibility with the old code
return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: net.ParseIP(ip).String()}}, nil
parsedIP := net.ParseIP(ip).String()
return []api.NodeAddress{
{Type: api.NodeLegacyHostIP, Address: parsedIP},
{Type: api.NodeInternalIP, Address: parsedIP},
{Type: api.NodeExternalIP, Address: parsedIP},
}, nil
}
// mapNodeNameToServerName maps from a k8s NodeName to a rackspace Server Name