Commit 99da56fb authored by Justin Santa Barbara's avatar Justin Santa Barbara

Fix problems identified in review

parent bc16d83a
...@@ -57,7 +57,7 @@ type TCPLoadBalancer interface { ...@@ -57,7 +57,7 @@ type TCPLoadBalancer interface {
// Instances is an abstract, pluggable interface for sets of instances. // Instances is an abstract, pluggable interface for sets of instances.
type Instances interface { type Instances interface {
// IPAddress returns an IP address of the specified instance. // NodeAddresses returns the addresses of the specified instance.
NodeAddresses(name string) ([]api.NodeAddress, error) NodeAddresses(name string) ([]api.NodeAddress, error)
// ExternalID returns the cloud provider ID of the specified instance. // ExternalID returns the cloud provider ID of the specified instance.
ExternalID(name string) (string, error) ExternalID(name string) (string, error)
......
...@@ -274,7 +274,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList, ...@@ -274,7 +274,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList,
if err != nil { if err != nil {
glog.Errorf("error getting instance addresses for %s: %v", node.Name, err) glog.Errorf("error getting instance addresses for %s: %v", node.Name, err)
} else { } else {
api.AddToNodeAddresses(&node.Status.Addresses, nodeAddresses...) node.Status.Addresses = nodeAddresses
} }
} }
} else { } else {
...@@ -283,7 +283,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList, ...@@ -283,7 +283,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList,
addr := net.ParseIP(node.Name) addr := net.ParseIP(node.Name)
if addr != nil { if addr != nil {
address := api.NodeAddress{Type: api.NodeLegacyHostIP, Address: addr.String()} address := api.NodeAddress{Type: api.NodeLegacyHostIP, Address: addr.String()}
api.AddToNodeAddresses(&node.Status.Addresses, address) node.Status.Addresses = []api.NodeAddress{address}
} else { } else {
addrs, err := s.lookupIP(node.Name) addrs, err := s.lookupIP(node.Name)
if err != nil { if err != nil {
...@@ -292,7 +292,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList, ...@@ -292,7 +292,7 @@ func (s *NodeController) PopulateAddresses(nodes *api.NodeList) (*api.NodeList,
glog.Errorf("No ip address for node %v", node.Name) glog.Errorf("No ip address for node %v", node.Name)
} else { } else {
address := api.NodeAddress{Type: api.NodeLegacyHostIP, Address: addrs[0].String()} address := api.NodeAddress{Type: api.NodeLegacyHostIP, Address: addrs[0].String()}
api.AddToNodeAddresses(&node.Status.Addresses, address) node.Status.Addresses = []api.NodeAddress{address}
} }
} }
} }
......
...@@ -118,7 +118,7 @@ func (f *FakeCloud) DeleteTCPLoadBalancer(name, region string) error { ...@@ -118,7 +118,7 @@ func (f *FakeCloud) DeleteTCPLoadBalancer(name, region string) error {
// NodeAddresses is a test-spy implementation of Instances.NodeAddresses. // NodeAddresses is a test-spy implementation of Instances.NodeAddresses.
// It adds an entry "node-addresses" into the internal method call record. // It adds an entry "node-addresses" into the internal method call record.
func (f *FakeCloud) NodeAddresses(instance string) ([]api.NodeAddress, error) { func (f *FakeCloud) NodeAddresses(instance string) ([]api.NodeAddress, error) {
f.addCall("ip-address") f.addCall("node-addresses")
return f.Addresses, f.Err return f.Addresses, f.Err
} }
......
...@@ -119,7 +119,7 @@ func (v *VagrantCloud) getInstanceByAddress(address string) (*SaltMinion, error) ...@@ -119,7 +119,7 @@ func (v *VagrantCloud) getInstanceByAddress(address string) (*SaltMinion, error)
return nil, fmt.Errorf("unable to find instance for address: %s", address) return nil, fmt.Errorf("unable to find instance for address: %s", address)
} }
// NodeAddresses returns the NodeAddress of a particular machine instance. // NodeAddresses returns the NodeAddresses of a particular machine instance.
func (v *VagrantCloud) NodeAddresses(instance string) ([]api.NodeAddress, error) { func (v *VagrantCloud) NodeAddresses(instance string) ([]api.NodeAddress, error) {
// Due to vagrant not running with a dedicated DNS setup, we return the IP address of a minion as its hostname at this time // Due to vagrant not running with a dedicated DNS setup, we return the IP address of a minion as its hostname at this time
minion, err := v.getInstanceByAddress(instance) minion, err := v.getInstanceByAddress(instance)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment