From 491664681060c017939c5d3ee265dad3da64d384 Mon Sep 17 00:00:00 2001 From: wlan0 Date: Mon, 6 Mar 2017 13:33:26 -0800 Subject: [PATCH] Use ProviderID to address nodes in the cloudprovider The cloudprovider is being refactored out of kubernetes core. This is being done by moving all the cloud-specific calls from kube-apiserver, kubelet and kube-controller-manager into a separately maintained binary(by vendors) called cloud-controller-manager. The Kubelet relies on the cloudprovider to detect information about the node that it is running on. Some of the cloudproviders worked by querying local information to obtain this information. In the new world of things, local information cannot be relied on, since cloud-controller-manager will not run on every node. Only one active instance of it will be run in the cluster. Today, all calls to the cloudprovider are based on the nodename. Nodenames are unqiue within the kubernetes cluster, but generally not unique within the cloud. This model of addressing nodes by nodename will not work in the future because local services cannot be queried to uniquely identify a node in the cloud. Therefore, I propose that we perform all cloudprovider calls based on ProviderID. This ID is a unique identifier for identifying a node on an external database (such as the instanceID in aws cloud). Change-Id: Ie0c4b3f0456a02b9af2846c5842da18939c9a15e --- openstack/openstack_instances.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openstack/openstack_instances.go b/openstack/openstack_instances.go index ce22459..cb64ed5 100644 --- a/openstack/openstack_instances.go +++ b/openstack/openstack_instances.go @@ -138,6 +138,13 @@ func (i *Instances) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) return addrs, nil } +// NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID +// This method will not be called from the node that is requesting this ID. i.e. metadata service +// and other local methods cannot be used here +func (i *Instances) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error) { + return []v1.NodeAddress{}, errors.New("unimplemented") +} + // ExternalID returns the cloud provider ID of the specified instance (deprecated). func (i *Instances) ExternalID(name types.NodeName) (string, error) { srv, err := getServerByName(i.compute, name) @@ -166,6 +173,13 @@ func (i *Instances) InstanceID(name types.NodeName) (string, error) { return "/" + srv.ID, nil } +// InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID +// This method will not be called from the node that is requesting this ID. i.e. metadata service +// and other local methods cannot be used here +func (i *Instances) InstanceTypeByProviderID(providerID string) (string, error) { + return "", errors.New("unimplemented") +} + // InstanceType returns the type of the specified instance. func (i *Instances) InstanceType(name types.NodeName) (string, error) { return "", nil