Merge pull request #7775 from simon3z/cloud-provider-id

api: add the ProviderID attribute to NodeSpec
This commit is contained in:
Tim Hockin
2015-05-28 15:54:00 -07:00
26 changed files with 200 additions and 23 deletions

View File

@@ -700,11 +700,19 @@ func (kl *Kubelet) initialNodeStatus() (*api.Node, error) {
}
// TODO(roberthbailey): Can we do this without having credentials to talk
// to the cloud provider?
instanceID, err := instances.ExternalID(kl.hostname)
// TODO: ExternalID is deprecated, we'll have to drop this code
externalID, err := instances.ExternalID(kl.hostname)
if err != nil {
return nil, fmt.Errorf("failed to get instance ID from cloud provider: %v", err)
return nil, fmt.Errorf("failed to get external ID from cloud provider: %v", err)
}
node.Spec.ExternalID = externalID
// TODO: We can't assume that the node has credentials to talk to the
// cloudprovider from arbitrary nodes. At most, we should talk to a
// local metadata server here.
node.Spec.ProviderID, err = cloudprovider.GetInstanceProviderID(kl.cloud, kl.hostname)
if err != nil {
return nil, err
}
node.Spec.ExternalID = instanceID
} else {
node.Spec.ExternalID = kl.hostname
}