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

ResourceList's Cpu() function claim to return "the CPU limit if specified" while returning the content of "cpu" instead of "limits.cpu" #94831

Closed
ArchangelX360 opened this issue Sep 16, 2020 · 13 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/node Categorizes an issue or PR as relevant to SIG Node.

Comments

@ArchangelX360
Copy link

ArchangelX360 commented Sep 16, 2020

What happened:

ResourceList's Cpu() function claim to return "the CPU limit if specified" while returning the content of ResourceName "cpu" instead of ResourceName "limits.cpu".

What you expected to happen:

I would expect Cpu() to return "limits.cpu" key content instead of "cpu" key content. Meaning using ResourceLimitsCPU ResourceName instead of ResourceCPU ResourceName.

It could be that the documentation of the function is invalid.

It seems as well that the confusion is coming from the fact that ResourceList struct is both used in the context of ResourceQuotaSpec but also in ResourceRequirements. Even though the manifest overall structure of these two is a little bit different.
Indeed, the information about wether the key is a limit or a request is fundamentally different in the two contexts:

How to reproduce it (as minimally and precisely as possible):

Non relevant.

Anything else we need to know?:

This is linked to the issue reported on the (I assume) wrong issue board: kubernetes/api#31

Environment:

  • Kubernetes version (use kubectl version): non relevant
  • Cloud provider or hardware configuration: non relevant
  • OS (e.g: cat /etc/os-release): non relevant
  • Kernel (e.g. uname -a): non relevant
  • Install tools: non relevant
  • Network plugin and version (if this is a network-related bug): non relevant
  • Others: non relevant
@ArchangelX360 ArchangelX360 added the kind/bug Categorizes issue or PR as related to a bug. label Sep 16, 2020
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Sep 16, 2020
@ArchangelX360
Copy link
Author

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 16, 2020
@ZihanJiang96
Copy link

I could work on this issue if this is a valid bug @ArchangelX360

@fedebongio
Copy link
Contributor

/sig node
in any case, if needs to be fixed it's going to be hard to make it backward compatible, so copying also the api reviewers label
/api-review

@k8s-ci-robot k8s-ci-robot added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Sep 17, 2020
@fedebongio
Copy link
Contributor

/label api-review

@k8s-ci-robot k8s-ci-robot added the api-review Categorizes an issue or PR as actively needing an API review. label Sep 17, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 16, 2020
@ArchangelX360
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 17, 2020
@liggitt
Copy link
Member

liggitt commented Jan 21, 2021

I would recommend:

  • fixing the documentation to accurately describe what is returned ("returns the value of the cpu resource")
  • sweeping in-tree uses to make sure we're only using it correctly

/remove-label api-review

@k8s-ci-robot k8s-ci-robot removed the api-review Categorizes an issue or PR as actively needing an API review. label Jan 21, 2021
@liggitt liggitt added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jan 21, 2021
@apoland
Copy link

apoland commented Jan 24, 2021

I'm willing to fix documentation and audit the use of this function.

@apoland
Copy link

apoland commented Jan 24, 2021

/assign

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 24, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 24, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
Development

No branches or pull requests

8 participants
@liggitt @apoland @fedebongio @ArchangelX360 @ZihanJiang96 @k8s-ci-robot @fejta-bot and others