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

Add support for enable-cadvisor-json-endpoints with Kubelet #10957

Conversation

adrianmoisey
Copy link
Contributor

Kubernetes 1.18 disables this by default.
For backwards compatibility with monitoring tools, it would be nice to
be able to re-enable this.

kubernetes/kubernetes#68522

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 1, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @adrianmoisey. 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 /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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 1, 2021
@adrianmoisey
Copy link
Contributor Author

/assign @KashifSaadat

@adrianmoisey adrianmoisey force-pushed the add_kubelet_arg_enable_cadvisor_json_endpoints branch 2 times, most recently from 12d2df8 to 316242d Compare March 1, 2021 08:12
@hakman
Copy link
Member

hakman commented Mar 1, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 1, 2021
@adrianmoisey adrianmoisey force-pushed the add_kubelet_arg_enable_cadvisor_json_endpoints branch 2 times, most recently from 2e0adcc to 9f24e36 Compare March 1, 2021 08:18
@adrianmoisey
Copy link
Contributor Author

@hakman I can't tell if the failed tests are related to this change. Is there anything I need to do?

@olemarkus
Copy link
Member

This flag will be removed in 1.21. We need to consider if this is a good time to add support for that flag.
See kubernetes/kubernetes#68522

@adrianmoisey
Copy link
Contributor Author

This flag will be removed in 1.21. We need to consider if this is a good time to add support for that flag.

This is something I thought about. Our situation is that we're currently upgrading from Kubernetes 1.17 to Kubernetes 1.18. Our monitoring service (datadog) doesn't have a workaround for the disabled enable-cadvisor-json-endpoints yes, so we're forced to enable this to get some metrics.

I do realise that it's a bit strange adding a deprecated flag currently. I'm unsure what kOps' policy on this is.

@hakman
Copy link
Member

hakman commented Mar 1, 2021

Maybe we could add it to 1.20 only?

@olemarkus
Copy link
Member

Maybe we could add it to 1.20 only?

If we add this, we should validate the k8s version (i.e from 1.18 up to and including 1.20), but we can put this in any kOps version supported these k8s version.

@adrianmoisey
Copy link
Contributor Author

For my use-case I'd need it in 1.18.

Is there any other way of manipulating the command line arguments that get sent to kubelet?

@olemarkus
Copy link
Member

I think the approach in the PR is fine. Just need that validation 0

@adrianmoisey
Copy link
Contributor Author

Great! Anything I need to do?

Also, who is responsible for cherry-picking it back into 1.18 and 1.19? Could I do that?

@hakman
Copy link
Member

hakman commented Mar 1, 2021

You would have to add something similar to:

if k.TopologyManagerPolicy != "" {
allErrs = append(allErrs, IsValidValue(kubeletPath.Child("topologyManagerPolicy"), &k.TopologyManagerPolicy, []string{"none", "best-effort", "restricted", "single-numa-node"})...)
if !c.IsKubernetesGTE("1.18") {
allErrs = append(allErrs, field.Forbidden(kubeletPath.Child("topologyManagerPolicy"), "topologyManagerPolicy requires at least Kubernetes 1.18"))
}
}

Regarding cherry-picking, we will take care of that at the end, but it will be to 1.20 and possibly 1.19, but for sure not 1.18.

@adrianmoisey
Copy link
Contributor Author

You would have to add something similar to:

Done this.

I was unsure of the values at the end of the line in https://github.com/kubernetes/kops/pull/10957/files#diff-ae412ac68b83570fd50e9d5d63873f060eb8f503f5e44be78d710076294c3285R521

Is that correct?

@hakman
Copy link
Member

hakman commented Mar 1, 2021

Is that correct?

No need for that, just the version check(s).

@adrianmoisey
Copy link
Contributor Author

Is there anything else needed from me?

pkg/apis/kops/validation/validation.go Outdated Show resolved Hide resolved
@hakman
Copy link
Member

hakman commented Mar 2, 2021

Please also squash all commits.

@adrianmoisey adrianmoisey force-pushed the add_kubelet_arg_enable_cadvisor_json_endpoints branch from 9900a2b to e2ee843 Compare March 2, 2021 09:43
@adrianmoisey
Copy link
Contributor Author

Done

Comment on lines 521 to 522
if c.IsKubernetesGTE("1.18") && c.IsKubernetesLT("1.21") {
allErrs = append(allErrs, field.Forbidden(kubeletPath.Child("enableCadvisorJsonEndpoints"), "enableCadvisorJsonEndpoints requires at least Kubernetes 1.18"))
Copy link
Member

@hakman hakman Mar 3, 2021

Choose a reason for hiding this comment

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

Sorry, my mistake. Please change and squash one more time.

Suggested change
if c.IsKubernetesGTE("1.18") && c.IsKubernetesLT("1.21") {
allErrs = append(allErrs, field.Forbidden(kubeletPath.Child("enableCadvisorJsonEndpoints"), "enableCadvisorJsonEndpoints requires at least Kubernetes 1.18"))
if c.IsKubernetesLT("1.18") && c.IsKubernetesGTE("1.21") {
allErrs = append(allErrs, field.Forbidden(kubeletPath.Child("enableCadvisorJsonEndpoints"), "enableCadvisorJsonEndpoints requires at Kubernetes 1.18-1.20"))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, my mistake. Please change and squash one more time.

No worries, I should have caught that.

Fixed

@adrianmoisey adrianmoisey force-pushed the add_kubelet_arg_enable_cadvisor_json_endpoints branch from e2ee843 to 253b91f Compare March 3, 2021 07:02
Kubernetes 1.18 disables this by default.
For backwards compatibility with monitoring tools, it would be nice to
be able to re-enable this.

kubernetes/kubernetes#68522
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 3, 2021

@adrianmoisey: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kops-verify-staticcheck 253b91f link /test pull-kops-verify-staticcheck

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@adrianmoisey adrianmoisey force-pushed the add_kubelet_arg_enable_cadvisor_json_endpoints branch from 253b91f to 9e18928 Compare March 3, 2021 07:06
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 3, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2021
@k8s-ci-robot k8s-ci-robot merged commit 83e1424 into kubernetes:master Mar 3, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 3, 2021
@hakman
Copy link
Member

hakman commented Mar 3, 2021

I think this was it. Thanks @adrianmoisey.

@adrianmoisey
Copy link
Contributor Author

Perfect! Thanks for the help! I really appreciate it.

@adrianmoisey adrianmoisey deleted the add_kubelet_arg_enable_cadvisor_json_endpoints branch March 3, 2021 08:06
k8s-ci-robot added a commit that referenced this pull request Mar 3, 2021
…-upstream-release-1.20

Automated cherry pick of #10957: Add support for enable-cadvisor-json-endpoints with Kubelet
k8s-ci-robot added a commit that referenced this pull request Mar 3, 2021
…-upstream-release-1.19

Automated cherry pick of #10957: Add support for enable-cadvisor-json-endpoints with Kubelet
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. area/api 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

None yet

5 participants