diff --git a/pkg/cloudprovider/aws/aws.go b/pkg/cloudprovider/aws/aws.go index 64b5652b62a..d0f67665b01 100644 --- a/pkg/cloudprovider/aws/aws.go +++ b/pkg/cloudprovider/aws/aws.go @@ -427,7 +427,7 @@ func (aws *AWSCloud) NodeAddresses(name string) ([]api.NodeAddress, error) { return addresses, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (aws *AWSCloud) ExternalID(name string) (string, error) { inst, err := aws.getInstancesByDnsName(name) if err != nil { @@ -436,6 +436,11 @@ func (aws *AWSCloud) ExternalID(name string) (string, error) { return *inst.InstanceID, nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (aws *AWSCloud) InstanceID(name string) (string, error) { + return "", nil +} + // Return the instances matching the relevant private dns name. func (aws *AWSCloud) getInstancesByDnsName(name string) (*ec2.Instance, error) { f := &ec2InstanceFilter{} diff --git a/pkg/cloudprovider/cloud.go b/pkg/cloudprovider/cloud.go index 499555630d8..db387085391 100644 --- a/pkg/cloudprovider/cloud.go +++ b/pkg/cloudprovider/cloud.go @@ -87,8 +87,10 @@ type Instances interface { // returns the address of the calling instance. We should do a rename to // make this clearer. 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 (deprecated). ExternalID(name string) (string, error) + // InstanceID returns the cloud provider ID of the specified instance. + InstanceID(name string) (string, error) // List lists instances that match 'filter' which is a regular expression which must match the entire instance name (fqdn) List(filter string) ([]string, error) // GetNodeResources gets the resources for a particular node diff --git a/pkg/cloudprovider/fake/fake.go b/pkg/cloudprovider/fake/fake.go index 6be5618fcd2..15ef13c1522 100644 --- a/pkg/cloudprovider/fake/fake.go +++ b/pkg/cloudprovider/fake/fake.go @@ -159,6 +159,12 @@ func (f *FakeCloud) ExternalID(instance string) (string, error) { return f.ExtID[instance], f.Err } +// InstanceID returns the cloud provider ID of the specified instance. +func (f *FakeCloud) InstanceID(instance string) (string, error) { + f.addCall("instance-id") + return f.ExtID[instance], nil +} + // List is a test-spy implementation of Instances.List. // It adds an entry "list" into the internal method call record. func (f *FakeCloud) List(filter string) ([]string, error) { diff --git a/pkg/cloudprovider/gce/gce.go b/pkg/cloudprovider/gce/gce.go index ffde04d696a..4ed1f4b63ef 100644 --- a/pkg/cloudprovider/gce/gce.go +++ b/pkg/cloudprovider/gce/gce.go @@ -488,7 +488,7 @@ func (gce *GCECloud) NodeAddresses(_ string) ([]api.NodeAddress, error) { }, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (gce *GCECloud) ExternalID(instance string) (string, error) { inst, err := gce.getInstanceByName(instance) if err != nil { @@ -497,6 +497,11 @@ func (gce *GCECloud) ExternalID(instance string) (string, error) { return strconv.FormatUint(inst.Id, 10), nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (gce *GCECloud) InstanceID(instance string) (string, error) { + return "", nil +} + // List is an implementation of Instances.List. func (gce *GCECloud) List(filter string) ([]string, error) { listCall := gce.service.Instances.List(gce.projectID, gce.zone) diff --git a/pkg/cloudprovider/mesos/mesos.go b/pkg/cloudprovider/mesos/mesos.go index cd2560c6dae..cacc3b40b17 100644 --- a/pkg/cloudprovider/mesos/mesos.go +++ b/pkg/cloudprovider/mesos/mesos.go @@ -166,7 +166,7 @@ func ipAddress(name string) (net.IP, error) { return ipaddr, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (c *MesosCloud) ExternalID(instance string) (string, error) { ip, err := ipAddress(instance) if err != nil { @@ -175,6 +175,11 @@ func (c *MesosCloud) ExternalID(instance string) (string, error) { return ip.String(), nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (c *MesosCloud) InstanceID(name string) (string, error) { + return "", nil +} + // List lists instances that match 'filter' which is a regular expression // which must match the entire instance name (fqdn). func (c *MesosCloud) List(filter string) ([]string, error) { diff --git a/pkg/cloudprovider/openstack/openstack.go b/pkg/cloudprovider/openstack/openstack.go index 9c722307480..aa754467dd6 100644 --- a/pkg/cloudprovider/openstack/openstack.go +++ b/pkg/cloudprovider/openstack/openstack.go @@ -357,7 +357,7 @@ func (i *Instances) NodeAddresses(name string) ([]api.NodeAddress, error) { return addrs, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (i *Instances) ExternalID(name string) (string, error) { srv, err := getServerByName(i.compute, name) if err != nil { @@ -366,6 +366,11 @@ func (i *Instances) ExternalID(name string) (string, error) { return srv.ID, nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (i *Instances) InstanceID(name string) (string, error) { + return "", nil +} + func (i *Instances) GetNodeResources(name string) (*api.NodeResources, error) { glog.V(4).Infof("GetNodeResources(%v) called", name) diff --git a/pkg/cloudprovider/ovirt/ovirt.go b/pkg/cloudprovider/ovirt/ovirt.go index ad8e59e70e2..a912484e488 100644 --- a/pkg/cloudprovider/ovirt/ovirt.go +++ b/pkg/cloudprovider/ovirt/ovirt.go @@ -167,7 +167,7 @@ func (v *OVirtCloud) NodeAddresses(name string) ([]api.NodeAddress, error) { return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: address.String()}}, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (v *OVirtCloud) ExternalID(name string) (string, error) { instance, err := v.fetchInstance(name) if err != nil { @@ -176,6 +176,11 @@ func (v *OVirtCloud) ExternalID(name string) (string, error) { return instance.UUID, nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (v *OVirtCloud) InstanceID(name string) (string, error) { + return "", nil +} + func getInstancesFromXml(body io.Reader) (OVirtInstanceMap, error) { if body == nil { return nil, fmt.Errorf("ovirt rest-api response body is missing") diff --git a/pkg/cloudprovider/rackspace/rackspace.go b/pkg/cloudprovider/rackspace/rackspace.go index ead98594b88..8df8230da65 100644 --- a/pkg/cloudprovider/rackspace/rackspace.go +++ b/pkg/cloudprovider/rackspace/rackspace.go @@ -366,11 +366,16 @@ func (i *Instances) NodeAddresses(name string) ([]api.NodeAddress, error) { return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: net.ParseIP(ip).String()}}, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (i *Instances) ExternalID(name string) (string, error) { return "", fmt.Errorf("unimplemented") } +// InstanceID returns the cloud provider ID of the specified instance. +func (i *Instances) InstanceID(name string) (string, error) { + return "", nil +} + func (i *Instances) GetNodeResources(name string) (*api.NodeResources, error) { glog.V(2).Infof("GetNodeResources(%v) called", name) diff --git a/pkg/cloudprovider/vagrant/vagrant.go b/pkg/cloudprovider/vagrant/vagrant.go index 58542d5b37f..bb606346df5 100644 --- a/pkg/cloudprovider/vagrant/vagrant.go +++ b/pkg/cloudprovider/vagrant/vagrant.go @@ -142,7 +142,7 @@ func (v *VagrantCloud) NodeAddresses(instance string) ([]api.NodeAddress, error) return []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: ip.String()}}, nil } -// ExternalID returns the cloud provider ID of the specified instance. +// ExternalID returns the cloud provider ID of the specified instance (deprecated). func (v *VagrantCloud) ExternalID(instance string) (string, 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 minion, err := v.getInstanceByAddress(instance) @@ -152,6 +152,11 @@ func (v *VagrantCloud) ExternalID(instance string) (string, error) { return minion.IP, nil } +// InstanceID returns the cloud provider ID of the specified instance. +func (v *VagrantCloud) InstanceID(instance string) (string, error) { + return "", nil +} + // saltMinionsByRole filters a list of minions that have a matching role. func (v *VagrantCloud) saltMinionsByRole(minions []SaltMinion, role string) []SaltMinion { var filteredMinions []SaltMinion