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

Use ProviderID to address nodes in the cloudprovider #42604

Merged
merged 1 commit into from
Mar 28, 2017

Conversation

wlan0
Copy link
Member

@wlan0 wlan0 commented Mar 7, 2017

The cloudprovider is being refactored out of kubernetes core. This is being
done by moving all the cloud-specific calls from kube-apiserver, kubelet and
kube-controller-manager into a separately maintained binary(by vendors) called
cloud-controller-manager. The Kubelet relies on the cloudprovider to detect information
about the node that it is running on. Some of the cloudproviders worked by
querying local information to obtain this information. In the new world of things,
local information cannot be relied on, since cloud-controller-manager will not
run on every node. Only one active instance of it will be run in the cluster.

Today, all calls to the cloudprovider are based on the nodename. Nodenames are
unqiue within the kubernetes cluster, but generally not unique within the cloud.
This model of addressing nodes by nodename will not work in the future because
local services cannot be queried to uniquely identify a node in the cloud. Therefore,
I propose that we perform some(to start off with) of the cloudprovider calls based on
ProviderID. This ID is a unique identifier for identifying a node on an external database (such as
the instanceID in aws cloud).

In the next PR, i'll add support to initialize nodes from the cloud-controller-manager instead of the kubelet using this API.

@thockin @keontang @joonas @luxas @justinsb

@k8s-ci-robot
Copy link
Contributor

Hi @wlan0. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 7, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

The following people have approved this PR: wlan0

Needs approval from an approver in each of these OWNERS Files:

We suggest the following people:
cc @mikedanese
You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Mar 7, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@thockin
Copy link
Member

thockin commented Mar 7, 2017

@k8s-bot ok to test

@thockin thockin added release-note Denotes a PR that will be considered when it comes time to generate release notes. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed release-note-label-needed labels Mar 7, 2017
@thockin thockin assigned thockin and unassigned rootfs Mar 7, 2017
// ProviderID is a unique identifier of the node. This will not be called
// from the node whose nodeaddresses are being queried. i.e. local metadata
// services cannot be used in this method to obtain nodeaddresses
NodeAddressesV2(providerId string) ([]v1.NodeAddress, error)
Copy link
Member

Choose a reason for hiding this comment

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

NodeAddressesByProviderID, please?

// ExternalID returns the cloud provider ID of the node with the specified NodeName.
// Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)
ExternalID(nodeName types.NodeName) (string, error)
// InstanceID returns the cloud provider ID of the node with the specified NodeName.
InstanceID(nodeName types.NodeName) (string, error)
// InstanceType returns the type of the specified instance.
InstanceType(name types.NodeName) (string, error)
// InstanceTypeV2 returns the type of the specified instance.
InstanceTypeV2(providerID string) (string, error)
Copy link
Member

Choose a reason for hiding this comment

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

InstanceTypeByProviderID please

@thockin
Copy link
Member

thockin commented Mar 7, 2017

I'm wary of panic here - do we do that for other not-implemented methods?

@wlan0
Copy link
Member Author

wlan0 commented Mar 8, 2017

@thockin panic is not needed. I've changed them to errors, and addressed the other two comments.

@k8s-bot bazel test this

@luxas
Copy link
Member

luxas commented Mar 8, 2017

@wlan0 this targets v1.7, right?

@wlan0
Copy link
Member Author

wlan0 commented Mar 8, 2017

yes @luxas

@wlan0 wlan0 force-pushed the provider-id branch 2 times, most recently from e7fd243 to a44a30c Compare March 10, 2017 01:15
@justinsb
Copy link
Member

This will actually be very helpful on AWS.

We've also debated pushing in the whole Node object in the past, because it also includes other information like the zone, which saves a lookup on GCE. cc @jingxu97 And we do actually push the whole object for LoadBalancers, and this is used on OpenStack.

One suggestion: define a strong type like types.NodeName instead of using a string. You'll avoid a lot of bugs :-)

@wlan0 wlan0 force-pushed the provider-id branch 2 times, most recently from aa24908 to 041a3f0 Compare March 10, 2017 18:52
@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 13, 2017
@thockin
Copy link
Member

thockin commented Mar 13, 2017

I heartily endorse the idea of typedefs for things like this.

@wlan0
Copy link
Member Author

wlan0 commented Mar 17, 2017

It's a flake error -

@k8s-bot cvm gce e2e test this

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2017
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 28, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 28, 2017
@wlan0 wlan0 force-pushed the provider-id branch 2 times, most recently from 35d14fe to 43239ed Compare March 28, 2017 02:11
@wlan0
Copy link
Member Author

wlan0 commented Mar 28, 2017

Flake!

@k8s-bot verify test this

The cloudprovider is being refactored out of kubernetes core. This is being
done by moving all the cloud-specific calls from kube-apiserver, kubelet and
kube-controller-manager into a separately maintained binary(by vendors) called
cloud-controller-manager. The Kubelet relies on the cloudprovider to detect information
about the node that it is running on. Some of the cloudproviders worked by
querying local information to obtain this information. In the new world of things,
local information cannot be relied on, since cloud-controller-manager will not
run on every node. Only one active instance of it will be run in the cluster.

Today, all calls to the cloudprovider are based on the nodename. Nodenames are
unqiue within the kubernetes cluster, but generally not unique within the cloud.
This model of addressing nodes by nodename will not work in the future because
local services cannot be queried to uniquely identify a node in the cloud. Therefore,
I propose that we perform all cloudprovider calls based on ProviderID. This ID is
a unique identifier for identifying a node on an external database (such as
the instanceID in aws cloud).
@thockin
Copy link
Member

thockin commented Mar 28, 2017 via email

@luxas
Copy link
Member

luxas commented Mar 28, 2017

Builds green, re-applying lgtm

@luxas luxas added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 28, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c888069 into kubernetes:master Mar 28, 2017
@wlan0
Copy link
Member Author

wlan0 commented Mar 28, 2017

This is great! just one more PR to go, before external cloud kubelet!

@bowei
Copy link
Member

bowei commented Mar 28, 2017

the gce code should really go into gce_instances.go...

@wlan0
Copy link
Member Author

wlan0 commented Mar 28, 2017

@bowei #43777

dims pushed a commit to dims/kubernetes that referenced this pull request Feb 8, 2018
Automatic merge from submit-queue

Use ProviderID to address nodes in the cloudprovider

The cloudprovider is being refactored out of kubernetes core. This is being
done by moving all the cloud-specific calls from kube-apiserver, kubelet and
kube-controller-manager into a separately maintained binary(by vendors) called
cloud-controller-manager. The Kubelet relies on the cloudprovider to detect information
about the node that it is running on. Some of the cloudproviders worked by
querying local information to obtain this information.  In the new world of things,
local information cannot be relied on, since cloud-controller-manager will not
run on every node. Only one active instance of it will be run in the cluster.

Today, all calls to the cloudprovider are based on the nodename. Nodenames are
unqiue within the kubernetes cluster, but generally not unique within the cloud.
This model of addressing nodes by nodename will not work in the future because
local services cannot be queried to uniquely identify a node in the cloud. Therefore,
I propose that we perform some(to start off with) of the cloudprovider calls based on 
ProviderID. This ID is a unique identifier for identifying a node on an external database (such as
the instanceID in aws cloud).

In the next PR, i'll add support to initialize nodes from the cloud-controller-manager instead of the kubelet using this API. 

@thockin @keontang @joonas @luxas @justinsb 

```release-note
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants