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

Node addresses #4434

Merged
merged 1 commit into from
Mar 5, 2015
Merged

Node addresses #4434

merged 1 commit into from
Mar 5, 2015

Conversation

ddysher
Copy link
Contributor

@ddysher ddysher commented Feb 13, 2015

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

// 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"`
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

@ddysher
Copy link
Contributor Author

ddysher commented Feb 17, 2015

Thanks for the review. I'll update the code after we agree with the API change.

@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.

@justinsb
Copy link
Member

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.

@justinsb
Copy link
Member

justinsb commented Mar 3, 2015

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 :-)

@ddysher
Copy link
Contributor Author

ddysher commented Mar 3, 2015

@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.

@justinsb
Copy link
Member

justinsb commented Mar 3, 2015

Thanks - I really appreciate it. If there is anything I can do to help, just ping me (I'm @justinsb BTW)

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Mar 3, 2015
@ddysher ddysher force-pushed the node-hostip branch 2 times, most recently from ce87fed to 48d0929 Compare March 3, 2015 21:23
@ddysher
Copy link
Contributor Author

ddysher commented Mar 3, 2015

doh. I know you are @justinsb. I'm surpirsed github cant inference name for me.

Some changes:

  1. Removed LegacyHostIP from public IP. Only internal version needs it.
  2. During conversion from external to internal version, if HostIP is set, then we add a new entry in NodeAddresses; if not, just ignore it (in which case user should be using api.NodeInternalIP, etc)
  3. During conversion from internal to external version, set HostIP to NodeAddress[api.NodeLegacyIP] if any.
  4. Before we drop suport for v1beta1/2, pod cache will pick up LegacyHostIP first, then internal ip, then external ip.


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"`
Copy link
Member

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.

@bgrant0607
Copy link
Member

Pretty close. Please address comments.

@bgrant0607
Copy link
Member

Please fix the build failure.

@ddysher
Copy link
Contributor Author

ddysher commented Mar 4, 2015

Rebased. merge error from #4994 (method name conflict).

@bgrant0607
Copy link
Member

LGTM

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 5, 2015
bgrant0607 added a commit that referenced this pull request Mar 5, 2015
@bgrant0607 bgrant0607 merged commit 9fcb48c into kubernetes:master Mar 5, 2015
@ddysher ddysher deleted the node-hostip branch March 13, 2016 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants