website icon indicating copy to clipboard operation
website copied to clipboard

Warn people about mistaking "M" suffix for "m" when setting resource limits

Open dialogbox opened this issue 5 years ago • 19 comments

Although it's not recommended, we also support 'm' as an unit for memory which means milli-bytes.

https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go#L46

We need to document it.

https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory

dialogbox avatar Nov 16 '21 02:11 dialogbox

@dialogbox can you explain why? I imagine it's in case someone writes a quantity as, eg, 256m meaning 256Mi, and they don't realize their error?

We do document quantities: https://kubernetes.io/docs/reference/glossary/?all=true#term-quantity

/priority awaiting-more-evidence /language en

sftim avatar Nov 16 '21 18:11 sftim

@sftim Yes. That is exactly the case. Although we have a document about the general quantities, this page would be the page someone who is searching about memory configuration.

And since this page also mentions but only mentions E, P, T, G, M, k, and since 'm' just works, I saw some people blindly assumed that the 'm' means 'Mega'. This might not be a big problem for resource limits because the differences are so huge like 1/1,000,000,000, most likely this mistake will cause cgroup OOM. However, when it comes to the resource requests, it's not easy to know there is some mistake. But pod scheduling might work incorrectly because the the requests is incorrect.

So I'm requesting to add this as a kind of warning.

dialogbox avatar Nov 17 '21 10:11 dialogbox

/triage accepted /kind feature /priority backlog /help /language en

Thanks for clarifying. Let's try to use a glossary tooltip for what we mean by “quantity”, too, if we can.

sftim avatar Nov 17 '21 11:11 sftim

@sftim: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/triage accepted /kind feature /priority backlog /help /language en

Thanks for clarifying. Let's try to use a glossary tooltip for what we mean by “quantity”, too, if we can.

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 avatar Nov 17 '21 11:11 k8s-ci-robot

/retitle Warn people about mistaking "M" suffix for "m" when setting resource limits

sftim avatar Nov 17 '21 11:11 sftim

Hi, I would like to work on this.

Babapool avatar Nov 20 '21 13:11 Babapool

/assign

Babapool avatar Nov 20 '21 13:11 Babapool

I was thinking to solve the PR in the following manner:

  1. On the page https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory I will add 'm (milli)' in the list of suffixes.
  2. Before the example I would include a Caution/ Note mentioning While setting resource limits one should not mistake the m (mili) suffix as M (mega) suffix as similar unit of memory. (I will change this text to a more suitable one)
  3. In the same Note/Caution I will try to add the glossary tooltip for memory.

Babapool avatar Nov 20 '21 13:11 Babapool

@sftim @dialogbox Could be you please provide your inputs for my method above to fix this PR. Thanks.

Babapool avatar Nov 20 '21 13:11 Babapool

@Babapool I love the idea of having the Caution/ Note. Can you please add the comment to the https://github.com/kubernetes/website/pull/30501?

dialogbox avatar Nov 22 '21 06:11 dialogbox

@dialogbox Let me ask the reviewers on #30501 on how to proceed on the same and as per their advice/suggestion I will do the necessary changes as I have no experience on editing already generated PRs.

Babapool avatar Nov 22 '21 07:11 Babapool

@dialogbox Since you have squashed and merged the commits in #30501 can ask whether I could add the Caution/Note part ?

Babapool avatar Nov 24 '21 14:11 Babapool

@Babapool I think making it as caution/note is a reasonable idea but I'm not sure if others would agree on that. How about keep having discussion here and filing a new pr for adding Caution/Note once we got concluded?

dialogbox avatar Nov 24 '21 14:11 dialogbox

@dialogbox Thanks I will ask them again the PR conversation.

Babapool avatar Nov 24 '21 14:11 Babapool

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Feb 23 '22 06:02 k8s-triage-robot

/remove-lifecycle stale

vaibhav2107 avatar Mar 06 '22 21:03 vaibhav2107

This issue is fixed by PR #30501. I believe that this issue can be closed. Thanks.

Babapool avatar Mar 08 '22 18:03 Babapool

/close

sftim avatar Mar 08 '22 19:03 sftim

@sftim: Closing this issue.

In response to this:

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

k8s-ci-robot avatar Mar 08 '22 19:03 k8s-ci-robot