Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudprovider: add instance id to NodeSpec #4383

Merged
merged 7 commits into from
Feb 26, 2015

Conversation

simon3z
Copy link
Contributor

@simon3z simon3z commented Feb 12, 2015

Sometimes for external applications it is important to identify the cloud instance of the nodes. Until this patch there was no contract that the node name returned by List was also the unique identifier of the cloud instance. This new API ensures that an external application can reliably retrieve the relevant instance id of the nodes.

@@ -673,6 +673,8 @@ type Minion struct {
Status NodeStatus `json:"status,omitempty" description:"current status of node"`
// Labels for the node
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize minions; labels of a minion assigned by the scheduler must match the scheduled pod's nodeSelector"`
// External ID of the node assigned by the cloud provider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we run in physical machine settings too, do we want something more generic than "cloud provider"? Perhaps:

"External ID of the node assigned by some machine database (e.g. a cloud provider)"

@brendandburns
Copy link
Contributor

@bgrant0607 for API thoughts.

This seems reasonable to me, but I'd prefer to land it with implementations for AWS and GCE (if not OpenStack and Vagrant)

@bgrant0607
Copy link
Member

Re. API:

  1. This is the Node API. "Instance" is cloud jargon. As @brendandburns pointed out, we run on bare metal, too, so I don't want to couple the API too closely to cloud providers. I'd be happier with externalID, which would better match the description.
  2. Status information should be reconstructable. We can rediscover container IDs from Docker. Do we expect all externalIDs to be similarly discoverable? It seems like that might not be true, in general, esp. for bare metal. Given that the external ID will be provided when the node is created and shouldn't change so long as the node exists, I think it makes more sense to be in the NodeSpec.

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@simon3z
Copy link
Contributor Author

simon3z commented Feb 16, 2015

@bgrant0607 I implemented all the cloud providers but I guess I'll need other people's help to test them. I could verify just the ovirt one.

@thockin
Copy link
Member

thockin commented Feb 17, 2015

I'm punting at Brendan - I am out the second half of this week and crazy slammed the first half.

@deads2k
Copy link
Contributor

deads2k commented Feb 17, 2015

I'll test on vagrant after #4468 merges.

@simon3z
Copy link
Contributor Author

simon3z commented Feb 17, 2015

@bgrant0607 I'd prefer to keep ExternalID in Status vs Spec because I assume that a node can change ExternalID (e.g. vm cloned / decommissioned, etc.).

@bgrant0607
Copy link
Member

@simon3z A node shouldn't be able to change ExternalID. That would be a new node object. That said, Spec is updatable. Status must be 100% automatically reconstructable from other sources, and shouldn't be provided by the cluster administrator. Does ExternalID meet that requirement?

@simon3z simon3z changed the title cloudprovider: add instance id to NodeStatus cloudprovider: add instance id to NodeSpec Feb 19, 2015
@simon3z simon3z force-pushed the instances-id branch 2 times, most recently from 224c28e to 21b31bf Compare February 19, 2015 14:38
@simon3z
Copy link
Contributor Author

simon3z commented Feb 19, 2015

@bgrant0607 I moved it to Spec

@bgrant0607
Copy link
Member

API LGTM. Thanks.

What happens for providers for which this is not implemented?

FYI, maintainers are here:
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/MAINTAINERS.md
https://github.com/GoogleCloudPlatform/kubernetes/tree/master/docs/getting-started-guides

@derekwaynecarr for Vagrant
@doublerr for Rackspace
@justinsb for AWS
@jeffmendoza for Azure

@simon3z
Copy link
Contributor Author

simon3z commented Feb 19, 2015

@bgrant0607 if it's not implemented the error message (if any) is logged and the externalId won't be reported. Returning an empty string (and nil error) would be OK for providers that don't intend to expose the id.

@justinsb
Copy link
Member

So it looks like we're heading for a pattern where we add lots of methods to the cloud provider, where each method extracts one piece of information. My inclination would have been a pattern where we have a "GetInfo" call, which just gathers all the information. This seems like it would be more efficient (particularly as we start to collect more and more information) and simpler.

The AWS code looks fine, though I haven't tested it.

@brendandburns
Copy link
Contributor

I think I generally agree with @justinsb on the GetInfo call, but the whole cloud provider stuff needs a refactor anyway, so I'm not going to block the PR on that. Merging.

@jeffmendoza
Copy link
Contributor

if it's not implemented the error message (if any) is logged and the externalId won't be reported.
Returning an empty string (and nil error) would be OK for providers that don't intend to expose the id.

Sounds good.

This patch adds the support for returning the ip address of the instances
when reported by the guest-agent and from the rest-api.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Sometimes for external applications it is important to identify the
cloud instance of the nodes. Until this patch there was no contract
that the node name returned by List was also the unique identifier of
the cloud instance. This new API ensures that an external application
can reliably retrieve the relevant instance id of the nodes.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
brendandburns added a commit that referenced this pull request Feb 26, 2015
cloudprovider: add instance id to NodeSpec
@brendandburns brendandburns merged commit a862c37 into kubernetes:master Feb 26, 2015
@simon3z
Copy link
Contributor Author

simon3z commented Mar 3, 2015

@brendandburns if you agree with the GetInfo call refactoring I can start to work on that tomorrow (my final goal is to add another information and it seems that having separate class is not sustainable anymore). Thanks!

@simon3z
Copy link
Contributor Author

simon3z commented Mar 6, 2015

@brendandburns can you check my last question? do you have an answer for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants