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

play kube: set defaults to container resources #13157

Merged
merged 1 commit into from
Feb 23, 2022

Conversation

ydayagi
Copy link
Contributor

@ydayagi ydayagi commented Feb 7, 2022

this fixes #13115

the change tries to imitate k8s behavior.
when limits are not set the container's limits are all CPU and all RAM
when requests are missing then they are equal to limits

Signed-off-by: Yaron Dayagi ydayagi@redhat.com

@rhatdan
Copy link
Member

rhatdan commented Feb 7, 2022

Thanks @ydayagi the linter does not like your tests.
@cdoern @vrothberg @umohnani8 PTAL

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 8, 2022

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 8, 2022

@ydayagi: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 8, 2022

Thanks @ydayagi the linter does not like your tests. @cdoern @vrothberg @umohnani8 PTAL

@rhatdan @umohnani8 @vrothberg @cdoern
I think that the tests are failing due to some temporary/flaky timeout. can u please retest?

@TomSweeneyRedHat
Copy link
Member

All kinds of red test unhappiness @ydayagi

@rhatdan
Copy link
Member

rhatdan commented Feb 8, 2022

I told it to retest, will see how it does.

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 8, 2022

@TomSweeneyRedHat @rhatdan
looking at troubleshooting-cpu-limits....
could it be that Podman tests do not take into account memory and cpu limits? perhaps we don't test 'play kube' with limits?
or maybe, we should avoid setting limits (here) if user does not have permissions for it?

@rhatdan
Copy link
Member

rhatdan commented Feb 10, 2022

@cdoern @mheon PTAL

@Luap99
Copy link
Member

Luap99 commented Feb 11, 2022

Is a limit really what most people want by default? I don't have a opinion on that but I just want to make us aware that this will be a breaking change for users.

@rhatdan
Copy link
Member

rhatdan commented Feb 11, 2022

Well the guide should be to match what kubernetes does. @umohnani8 @saschagrunert @haircommander @mrunalp WDYT?

@cdoern
Copy link
Contributor

cdoern commented Feb 11, 2022

I am pretty sure for most of these fields a limit of 0 is the default which means no limit, or at least that is how podman parses a limit of 0 or nil in some circumstances. why would we place a resource limit that users aren't aware of?

@haircommander
Copy link
Collaborator

I'm actually having a bit of trouble finding the default limits here. mostly because poking around the documentation keeps pointing to limit ranges which allow you to customize the default limits and requests. @ydayagi do you have a pointer to where the defaults are specified in kube

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 13, 2022

I'm actually having a bit of trouble finding the default limits here. mostly because poking around the documentation keeps pointing to limit ranges which allow you to customize the default limits and requests. @ydayagi do you have a pointer to where the defaults are specified in kube

thank you all for your replies. I did not check the documentation. I tested a few times with an existing cluster. I think that as Dan mentioned we have to match the k8s behavior. Another reason to set default is the env var. If env var references the limit field but the field has no value then var value is wrong.

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 14, 2022

@rhatdan ?

@rhatdan
Copy link
Member

rhatdan commented Feb 14, 2022

If you generate a Pod with this, what does the podman generate kube YAML look like? Do we need to strip all of these fields back out?

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 14, 2022

If you generate a Pod with this, what does the podman generate kube YAML look like? Do we need to strip all of these fields back out?

indeed the result of 'generate kube' changed. I will fix that.

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 14, 2022

@rhatdan I removed the default setting in the container object. Instead, I use default values when setting the env var value (func envVarValue).

@ydayagi
Copy link
Contributor Author

ydayagi commented Feb 15, 2022

@rhatdan

  1. I could not figure out the reason for the failed tests. Can we restest?
  2. I think I'll have to rename the PR and bug to something like: defaults for env from resource

this fixes containers#13115

the change tries to immitate k8s behavior.
when limits are not set the container's limits are all CPU and all RAM
when requests are missing then they are equal to limits

Signed-off-by: Yaron Dayagi <ydayagi@redhat.com>
@umohnani8
Copy link
Member

LGTM

@rhatdan
Copy link
Member

rhatdan commented Feb 23, 2022

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, ydayagi

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 23, 2022
@openshift-merge-robot openshift-merge-robot merged commit 0d2bd53 into containers:main Feb 23, 2022
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

play kube: container resources (cpu, memory) do not have defaults
8 participants