-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Node addresses #4434
Node addresses #4434
Conversation
// NodePhase is the current lifecycle phase of the node. | ||
Phase NodePhase `json:"phase,omitempty"` | ||
// Conditions is an array of current node conditions. | ||
Conditions []NodeCondition `json:"conditions,omitempty"` | ||
// Queried from cloud provider, if available. | ||
Addresses []NodeAddress `json:"addresses,omitempty"` |
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.
Everywhere else in the API, we use "IP" rather than "Address". We should stick to that convention.
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.
Is this convention strictly enforced? Anything breaks if we change to address?
The reason to change ip to address is apparent, we want to support hostname too. We can change back to IPs and use a separate new list, but that seems a little redundant. See below comment.
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.
It's not enforced, but I'd like as much consistency as possible in v1beta3.
At the moment, is it possible for this list to contain hostnames? Besides, I don't think "Address" is appropriate for a hostname.
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.
Normally I would use "Host", but that doesn't work here. Maybe "Address" is the lesser evil.
@thockin Any preference re. the term we use to refer to something that may be either an IP address or hostname?
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.
yeah, the list can contain hostnames, and that's the intent.
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.
How about AlternateEndpoints -- so, including port?
We've discussed allowing hosts in Endpoints, in #4370.
I want Nodes to actually populate an Endpoints object, as discussed in #4440.
Endpoints will need to be able to carry various information (e.g., internal vs. external), as discussed in #4482 and elsewhere.
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.
Why Alternative in the Name? Do we have a primary Endpoint or Address?
Endpoints is more or less a concept in our service world now, do we want to overload it here? It's a little confusing, plus I don't know how useful it would be to have port. Whoever consumes the list should know the port, like api-server proxy.
I think what we need here is a list of equivalent address (external ip, internal ip, hostname). If the direction is to produce Endpoints in Node, then I'll need to take a deep look at how it might work.
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.
Ok, Addresses
is fine, at least for now. I don't have a better alternative.
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.
BTW, I do want to replace ResourceLocation with node and pod endpoints, but the endpoints wouldn't appear here in that form, regardless.
Thanks for the review. I'll update the code after we agree with the API change. |
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. |
Thanks for making this patch. I've used it as the basis for my AWS work (justinsb@0f43e6a), so hopefully we can get this merged soon :-) I agree with the comments. One thought on the legacy host IP enum: perhaps we should not add that to the public API. We can still populate the HostIP for v1beta1 and v1beta2 by looking for the "best" amongst the addresses returned: I would guess hostname > external ip > internal ip. That seems to be at least as good as the current state of things. |
I'd love to see this patch make progress ... the rebases are proving painful! @bgrant0607 If we make the proposed changes, are you happy with the idea of a list of "NodeAddress" objects with a enum-Kind and a string Value? And we can remove HostIP from v3? We can populate HostIP by simply taking the first address value when there is no "LegacyHostIp" enum value (because the cloud providers will initially just return a single address), until we rework the cloud providers to populate Addresses fully. I do think we should avoid returning that value to clients though, as we don't want them depending on it. @ddysher Can I help in any way? I'm happy to fork your PR and go through the iterations if you'd rather I did that, but I don't want to "steal your PR" unless you want me to :-) |
@justinlindh I'll work on it today :) Sorry I was distracted by something else. Personally, I think NodeAddress with enum-Kind and string Value makes sense for now. I'll see what @bgrant0607 have in mind. We will remove HostIP from v3. Agreed the legacy ip probably shouldn't appear in public API, but i'm a little concerned to just use the 'first address' as we may have different assumption everywhere. I'll revisit t the PR. |
Thanks - I really appreciate it. If there is anything I can do to help, just ping me (I'm @justinsb BTW) |
CLAs look good, thanks! |
ce87fed
to
48d0929
Compare
doh. I know you are @justinsb. I'm surpirsed github cant inference name for me. Some changes:
|
|
||
type NodeAddress struct { | ||
Type NodeAddressType `json:"type" description:"type of the node address, e.g. external ip, internal ip, hostname, etc"` | ||
Value string `json:"value" description:"string representation of the address"` |
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.
I'd use Address
rather than Value
.
Pretty close. Please address comments. |
Please fix the build failure. |
Rebased. merge error from #4994 (method name conflict). |
LGTM |
Deprecate Node.HostIP, use Node.Addresses.
This is mostly the api side of change. We need to update cloudprovider, etc. to differentiate different addresses.
I've aggressively removed HostIP from v1beta1/beta2. It causes troubles for conversions. Node is generally created from node controller, so I'd expect the change to have minimal user impact. If this is not desirable, we can leave it there and do the conversion of Node.HostIP <-> Node.Addresses.
@bgrant0607 @smarterclayton