-
Notifications
You must be signed in to change notification settings - Fork 41.5k
api: add the ProviderID attribute to NodeSpec #7775
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
Conversation
pkg/cloudprovider/cloud.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs on the top-level Interface, not on the Instances interface.
Why do you want to rename GetExternalID to GetInstanceID? It currently corresponds nicely with the API field of the same name. |
Similarly, why do you want to prefix the cloud provider ID onto the API objects' ExternalID's? What's the motivation for the change? |
@a-robinson I probably addressed all your comments. The answers to your questions should be now in the commit messages or the 3 patches. Thanks! |
@a-robinson this should be ready to be merged |
Sorry @simon3z, I was pulled away from my desk most of yesterday afternoon. I think this looks good now, but cc @bgrant0607 about the NodeSpec.ExternalID change since it effectively changes the V1 API. |
I am not in favor of this change. Changing the format of external ID is a breaking change. Also, I'd like a full URL to be a valid external ID. @simon3z What's the motivation? There is no PR description. |
@bgrant0607 the description is in each commit. |
Our node identifiers are a mess.
I would like the object name to be just that. It might coincide with other fields, but should not be abused for other purposes other than to interact with the Kubernetes API. Similarly, addresses should contain the authoritative means of determining how to contact the node. We probably need more information there, such as which address(es) can be used for authentication. The systemUUID is presumably used as a unique identifier on the system itself. I'm not sure that's too relevant to Kubernetes, but it's fine to return it. We totally lack a principled mechanism for relating a Kubernetes node to a VM in a cloudprovider or physical machine or VM in a machine registry/DB. That's what this PR is about. I'd like it to work for people maintaining their cloud providers. Identity of the cloudprovider and/or information about how to contact it are not specified, nor is information like the project, zone, region, etc. That's all implicit and internal, fixed when the cluster is created. For example: Although clusters are single-zone today, I don't want to bake that into the API. The GCE instance ID can't actually be used to look up the instance, so I don't know why we care about that. So what information would be useful? I think a URL to look up information about the node in the cloud provider would be useful. That's what I thought externalID should contain. We could rename that field to providerID or somesuch. Alternatively, we could split this into multiple fields, such as the name (and/or address?) of the cloudprovider, project/zone (which might be empty in some scenarios), and instance name/id (which might be empty if there is no external registry or cloudprovider). cc @davidopp @quinton-hoole @thockin @justinsb @a-robinson @roberthbailey @rjnagal @kelseyhightower @smarterclayton |
@bgrant0607 For AWS, we're using the instance name, but AWS has a much more natural instance key - the AWS Instance ID. It would be great if that were the identifier which the cloudprovider worked with, rather than (or in addition to) the name, which often requires an extra lookup. When you say a URL, do you mean an If someone was running a private cloud that used the EC2 API, we could probably tolerate I am +1 on name being irrelevant to the cloudprovider, and externalID / providerID being the reference for the provider. I think a URL makes more sense than multiple fields, with the scheme determining the cloud provider, and the remainder containing whatever additional information is required by the cloud provider in whatever format makes sense for that cloud. |
I meant a usable web URL that RESTy higher-level orchestrators or users could use without needing to understand how to construct such URLs for any particular cloud provider. I could see that some kind of custom URI that included provider, zone, etc. could be useful for enlightened clients. Those don't have to be mutually exclusive -- we could have multiple fields. |
@bgrant0607 actually I think we should split
So for example:
For clarity
|
Proposal: I suggest we add "providerID", which would use URL-like syntax as proposed in this PR, starting with provider://. The exact format would be provider-specific. GCE and AWS would include info such as project and zone. The ID should be resolvable. Therefore, GCE should use the instance name rather than the id. We can then just deprecate externalID and remove it when we remove v1beta1. We could add a usable http URL later, if needed. WDYT? Any other objections, opinions, requirements, etc.? |
By "ID should be resolvable", I mean that it should be easily/efficiently usable when looking up the instance with the cloud provider, not that it needs to be resolvable via DNS. |
If we are going to make providerID URL-like, why force a specific prefix? GCE has a RESTful URL that represents the instance resource, and it would be nice to avoid having to do |
@bgrant0607 this is probably far from being final but it should be a good approximation of what you proposed. |
Thanks, @simon3z. Requirements:
Other than that, I don't have strong opinions and delegate the final decision to @roberthbailey. |
pkg/cloudprovider/cloud.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Getter" functions in go don't start with "Get" so you should rename this to "ProviderID"
5540125
to
982e80d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bgrant0607 do we want to put a deprecated field into the v1 api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We'll rip it out when we rip out the beta API versions.
982e80d
to
4ecc2db
Compare
pkg/cloudprovider/gce/gce.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bgrant0607 should I use gce.getInstanceByName(instance)
to make sure that the instance is there or this is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just call canonicalizeInstanceName(instance) for now. Maybe we can verify via metadata server later.
4ecc2db
to
f9c7d71
Compare
LGTM. We can fix/improve this in subsequent PRs. Also, we should document the purposes of the various identifiers in docs/node.md. |
This patch adds the ProviderName method used to identify the cloud provider. Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
Signed-off-by: Federico Simoncelli <[email protected]>
f9c7d71
to
1a41082
Compare
api: add the ProviderID attribute to NodeSpec
No description provided.