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

kubelet: reading cloudinfo from cadvisor #21373

Merged

Conversation

enoodle
Copy link

@enoodle enoodle commented Feb 17, 2016

When no --cloud-provider flag is given, try to use data from cadvisor to
determine the ProviderID

@googlebot
Copy link

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. I signed it!) and we'll verify. Thanks.


  • 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 your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@k8s-bot
Copy link

k8s-bot commented Feb 17, 2016

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
@k8s-bot
Copy link

k8s-bot commented Feb 17, 2016

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
Copy link
Author

enoodle commented Feb 17, 2016

This depends on google/cadvisor#1109

@k8s-github-robot k8s-github-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 17, 2016
@enoodle enoodle changed the title kubelet: reading cloudinfo from cadvisor [WIP] kubelet: reading cloudinfo from cadvisor Feb 17, 2016
@enoodle
Copy link
Author

enoodle commented Feb 17, 2016

@deads2k I could use your help with this patch. It is small but depends on another patch of cAdvisor.

@deads2k
Copy link
Contributor

deads2k commented Feb 17, 2016

ok to test

@deads2k
Copy link
Contributor

deads2k commented Feb 17, 2016

@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,
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@eparis
Copy link
Contributor

eparis commented Feb 17, 2016

@deads2k you need to let myself/clayton/andy know. I added @enoodle to the CLA group.
@googlebot he signed it!

@eparis
Copy link
Contributor

eparis commented Feb 17, 2016

ok to test

if info.CloudProvider != cadvisorapi.UnkownProvider &&
info.CloudProvider != cadvisorapi.Baremetal {
node.Spec.ProviderID = strings.ToLower(string(info.CloudProvider)) +
":////" + string(info.InstanceID)
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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?

@googlebot
Copy link

CLAs look good, thanks!

@bgrant0607 bgrant0607 assigned vishh and unassigned eparis Feb 18, 2016
@k8s-bot
Copy link

k8s-bot commented Feb 23, 2016

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.

@deads2k
Copy link
Contributor

deads2k commented Feb 24, 2016

@enoodle you'll need to bring in the new bump so this can pass tests, right?

@vishh
Copy link
Contributor

vishh commented Feb 24, 2016

FYI: A new bump has to be a cherrypick on
google/cadvisor/tree/release-0.21. We want to restrict/audit changes to
cadvisor since we are stabilizing kube for v1.2 release.

On Wed, Feb 24, 2016 at 1:22 PM, David Eads notifications@github.com
wrote:

@enoodle https://github.com/enoodle you'll need to bring in the new
bump so this can pass tests, right?


Reply to this email directly or view it on GitHub
#21373 (comment)
.

@enoodle
Copy link
Author

enoodle commented Feb 25, 2016

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

@deads2k
Copy link
Contributor

deads2k commented Feb 25, 2016

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.

@enoodle
Copy link
Author

enoodle commented Feb 28, 2016

I ended up waiting on 0.22 :)

@enoodle enoodle changed the title [WIP] kubelet: reading cloudinfo from cadvisor kubelet: reading cloudinfo from cadvisor Mar 1, 2016
@ixdy
Copy link
Member

ixdy commented Mar 3, 2016

ok to test

I really don't know what's wrong here.

@enoodle
Copy link
Author

enoodle commented Mar 3, 2016

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

@deads2k
Copy link
Contributor

deads2k commented Mar 3, 2016

@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()
Copy link
Contributor

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.

@vishh
Copy link
Contributor

vishh commented Mar 3, 2016

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?

@enoodle
Copy link
Author

enoodle commented Mar 4, 2016

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

@bgrant0607
Copy link
Member

Punting out of 1.2

@enoodle
Copy link
Author

enoodle commented May 19, 2016

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

@vishh
Copy link
Contributor

vishh commented May 19, 2016

@enoodle Can you address the existing comments? This PR is good to go once you fix them.

@enoodle enoodle force-pushed the read_cadvisor_cloudinfo_in_kubelet branch from 915143c to 5ad12d9 Compare May 20, 2016 06:12
@enoodle
Copy link
Author

enoodle commented May 20, 2016

@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.
@enoodle enoodle force-pushed the read_cadvisor_cloudinfo_in_kubelet branch from 5ad12d9 to 7fb82d5 Compare May 22, 2016 15:42
@enoodle
Copy link
Author

enoodle commented May 26, 2016

@vishh ping. sorry for the nagging, just don't want this to be forgotten :)

@vishh vishh added 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. and removed release-note-label-needed labels May 27, 2016
@vishh vishh added this to the v1.3 milestone May 27, 2016
@vishh
Copy link
Contributor

vishh commented May 27, 2016

@enoodle LGTM

@k8s-bot
Copy link

k8s-bot commented May 27, 2016

GCE e2e build/test passed for commit 7fb82d5.

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants