-
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
kubelet: reading cloudinfo from cadvisor #21373
kubelet: reading cloudinfo from cadvisor #21373
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
1 similar comment
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
This depends on google/cadvisor#1109 |
@deads2k I could use your help with this patch. It is small but depends on another patch of cAdvisor. |
ok to test |
@googlebot @enoodle should be covered under the Red Hat CLA. |
@@ -2786,6 +2786,17 @@ func (kl *Kubelet) setNodeAddress(node *api.Node) error { | |||
return nil | |||
} | |||
|
|||
func (kl *Kubelet) updateCloudProviderFromMachineInfo( | |||
node *api.Node, |
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.
no need for these newlines.
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.
@enoodle ^^
@deads2k you need to let myself/clayton/andy know. I added @enoodle to the CLA group. |
ok to test |
if info.CloudProvider != cadvisorapi.UnkownProvider && | ||
info.CloudProvider != cadvisorapi.Baremetal { | ||
node.Spec.ProviderID = strings.ToLower(string(info.CloudProvider)) + | ||
":////" + string(info.InstanceID) |
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.
My lack of cadvisor knowledge shows here. Is this guaranteed to have a value? Setting it to :////
seems less than ideal.
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.
Sorry, I probably should have documented it.
If info.CloudProvider will always have a non empty value (it has a set of defined values in info/v1/machine.go. If it is not UnkownProvider (typo in code, will fix here) nor Baremetal then it is the name of a real cloud service. Same thing goes for info.InstanceID , it will be receive its value from a function that is supposed to return "Unknown" if there was an error while retrieving the value.
":////" is to conform with kubernetes's cloudproviders (pkg/cloudprovider/providers/*) that will write to ProviderID if cloud-provider flag is given to kubelet. The most verbose one write in the form of "cloudprovider://project/availability_zone/instance_name". Here I dont have project name or availability zone so I return them empty.
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.
@enoodle Can you add some comments explaining this?
8206a53
to
90d478e
Compare
CLAs look good, thanks! |
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
@enoodle you'll need to bring in the new bump so this can pass tests, right? |
FYI: A new bump has to be a cherrypick on On Wed, Feb 24, 2016 at 1:22 PM, David Eads notifications@github.com
|
@vishh @deads2k I am not 100% clear on the process of cherrypick to bump this. Should I make a PR in cadvisor to cherrypick google/cadvisor#1109 to google/cadvisor/tree/release-0.21 and then add a commit here that bumps kubernetes's cadvisor t 0.21 ? |
Based on how we do it for other godeps, yes. The one wrinkle is that you may need a new cadvisor tag cut to get the comment section in godeps.json to look clean. Ask in your cherry-pick pull. |
I ended up waiting on 0.22 :) |
ok to test I really don't know what's wrong here. |
@ixdy could it be something in the patch? Can you take a look at the diff and see if something pops up? It's only 16 lines. Thanks. |
@vishh it's a small patch that adds some significant utility. Can you review for 1.2? |
@@ -1089,6 +1089,11 @@ func (kl *Kubelet) initialNodeStatus() (*api.Node, error) { | |||
} | |||
} else { | |||
node.Spec.ExternalID = kl.hostname | |||
// If no cloud provider is defined - use the one detected by cadvisor | |||
info, err := kl.GetCachedMachineInfo() |
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.
FYI @roberthbailey: cAdvisor is already using the local metadata server to access GCE specific information. Relevant logic here.
What is the meta issue that this PR is trying to solve? I see that kubelet can now autodetect cloud provider. What other features will this PR enable? |
@vishh Mainly this one feature. This will also detect the instance name with the cloud provider allowing users to run specific code on the cloud provider platform regarding this specific instance. |
Punting out of 1.2 |
@vishh Can we take another look at this? It will be nice to automatically be able to know on which cloud we are running and also its currently the only way to work identify Azure as they don't have any cloud provider. This will allow for easier interaction with cross-cloud deployments that use Azure. |
@enoodle Can you address the existing comments? This PR is good to go once you fix them. |
915143c
to
5ad12d9
Compare
@vishh Thanks, I updated the PR. |
When no --cloud-provider flag is given, try to use data from cadvisor to determine the current cloud provider.
5ad12d9
to
7fb82d5
Compare
@vishh ping. sorry for the nagging, just don't want this to be forgotten :) |
@enoodle LGTM |
GCE e2e build/test passed for commit 7fb82d5. |
When no --cloud-provider flag is given, try to use data from cadvisor to
determine the ProviderID