Skip to content

add default resource requests to router creation #8495

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

Merged
merged 1 commit into from
Apr 27, 2016

Conversation

JacobTanenbaum
Copy link
Contributor

Add the ability to specify resource quotas on a router when it is
created using the "oadm router" command. When creating a router
without requests or limits oadm returns a warning that it is not
recommended to run a router without resource quotas.

if the limits or requests are not not passed the the router is still
built but a warning is returned that it is not advised to run a router
without requests and limits in a production environment

Also adds the flags help text to oadm help router

addresses: #8328

return fmt.Errorf("limits or requests could not be interpreted: %v", err)
}
if cfg.ResourceLimits == "" || cfg.ResourceRequests == "" {
glog.Warningf("Running %s without resource requests or limits is bad practice in a production environment", cfg.Name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ramr @derekwaynecarr is this too verbose?

Copy link
Contributor

Choose a reason for hiding this comment

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

will this mess up piped output?

Copy link
Member

Choose a reason for hiding this comment

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

The reality is we need to check that both memory and cpu have made an explicit request. Absent either resource, the pod is still 'BestEffort' qos and will be first to get the boot if a node finds itself out of resource and has eviction enabled (kube 1.3 feature). I think the warning can be updated to state: "Running %s with BestEffort quality of service is not recommended in a production environment. A resource request for cpu and memory is strongly recommended."

@liggitt
Copy link
Contributor

liggitt commented Apr 13, 2016

I thought @smarterclayton wanted to do limits/requests as a post-creation step, similar to volumes

@JacobTanenbaum
Copy link
Contributor Author

I was responding to the git issue, which asks for oadm to support limits and requests...I could be wrong but I don't believe that oadm can interact with a running pod. I don't see the harm in allowing the specification of limits and requests during creation. @smarterclayton @derekwaynecarr do you agree?

@liggitt
Copy link
Contributor

liggitt commented Apr 14, 2016

For persistent volumes, we recommend people create the registry, then use oc set volumes to add persistent storage volumes to the resulting deployment config. I think we'd recommend the same approach for setting limits and requests.

@eparis
Copy link
Member

eparis commented Apr 14, 2016

@liggitt I think jacob is right, we can't/shouldn't do this after and forgetting to do this up front leaves you in a really bad place. With storage the pod won't deploy because the mount can't be satisfied. But pods deploy just fine without a limit/request.

I almost feel like a request should be mandatory when deploying an infra container like this... (limit should be optional)

I'll wait for @smarterclayton to comment, but my opinion is this PR doesn't go far enough...

@eparis
Copy link
Member

eparis commented Apr 14, 2016

(but that doesn't mean I think clayton's generic limit/request setting cli is a bad idea)

@derekwaynecarr
Copy link
Member

I did request that we add these flags since it would allow the deployment to be right from the start rather than requiring multiple commands.

@smarterclayton discussed potentially having a set command to do this instead.

@eparis
Copy link
Member

eparis commented Apr 14, 2016

I think the set command is great. But do we really want the user experience to require 2 commands? Maybe we do. Even so, the warning part of this PR should go forward. (And who is writing the mythological set?)

@eparis
Copy link
Member

eparis commented Apr 14, 2016

My vote is that this PR goes in as it stands. (And we do the same for the registry)

@derekwaynecarr
Copy link
Member

@eparis - in case my previous comment was ambiguous, I would like to see --requests and --limits supported on this command. I also like the warning, but wonder if its better The only thing I wonder is if other things set requests or limits in admission path that it would maybe be better to warn after the deployment is created if we see the resultant object has no requests. I think it should be fine to run a router without limits, and requests will default to limits if not specified on the server.

@0xmichalis
Copy link
Contributor

@smarterclayton has also pointed the oadm router -o yaml | oc set | oc create -f - flow for having oc set work prior to actual creation (note it was for some sort of testing) but I don't know if a normal user would do such a thing.

@smarterclayton
Copy link
Contributor

smarterclayton commented Apr 15, 2016 via email

@smarterclayton
Copy link
Contributor

These commands are at the limit of complexity that is reasonable. I am not in favor of adding to them. Solve the general problem and enable everyone, don't patch up the corners.

@eparis
Copy link
Member

eparis commented Apr 18, 2016

@smarterclayton agreed. Fix the general problem.

But what you are saying is the command we provide to deploy a registry or router is incapable of deploying a supported registry or router. That seems a little nutty... I think we should either default in some requests and not expose the flag or we expose the flags. I'm all for defaulting actually....

@eparis
Copy link
Member

eparis commented Apr 18, 2016

@JacobTanenbaum can you take on the task of creating a generic command to set requests and limits?

@smarterclayton
Copy link
Contributor

Routers and registries don't have to have resource limits or requests -
long term our pattern won't be to predefine these, it will be to have them
be applied / defaulted by the cluster. The router memory usage is
proportional to the number of routes, so the size we set cannot be upper
bounded without potentially resulting in the router being broken (if we
pick an arbitrarily low value).

Where's the justification that router and registry must have
requests/limits to be supportable?

@eparis
Copy link
Member

eparis commented Apr 18, 2016

I wasn't saying we should default limits/upper bounds. I said requests/minimums. A pod without a request is the first pod to be cpu starved, to be oom killed, to be kicked off a node, and to be unschedulable. So basically we only provide commands to run the most important infrastructure pieces in the least reliable completely unsupportable way :-(

@smarterclayton
Copy link
Contributor

I'd be fine with defaulting a request based on our predicted use.

On Mon, Apr 18, 2016 at 2:02 PM, Eric Paris [email protected]
wrote:

I wasn't saying we should default limits/upper bounds. I said
requests/minimums. A pod without a request is the first pod to be cpu
starved, to be oom killed, to be kicked off a node, and to be
unschedulable. So basically we only provide commands to run the most
important infrastructure pieces in the least reliable completely
unsupportable way :-(


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8495 (comment)

@knobunc
Copy link
Contributor

knobunc commented Apr 20, 2016

So, to summarize:

  • Set a default of 100 millicores for CPU, and whatever the router needs for memory + a little for the requests, always, when we make a router
  • Change oc set to take a new class of thing for resource quota that allows you to set limits and requests
  • Change the docs to describe all of this, and advise people how to set things up properly

Is that about right?

@smarterclayton
Copy link
Contributor

Yes - but the oc set work should start upstream with Kube unless we have
real problems (we're in the process of gradually moving oc set upstream)

On Wed, Apr 20, 2016 at 10:20 AM, Ben Bennett [email protected]
wrote:

So, to summarize:

  • Set a default of 100 millicores for CPU, and whatever the router
    needs for memory + a little for the requests, always, when we make a router
  • Change oc set to take a new class of thing for resource quota that
    allows you to set limits and requests
  • Change the docs to describe all of this, and advise people how to
    set things up properly

Is that about right?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8495 (comment)

@JacobTanenbaum
Copy link
Contributor Author

Is there something I can do to help with the oc set migration? or ensuring that support for limits and requests are supported there?

@eparis
Copy link
Member

eparis commented Apr 21, 2016

@JacobTanenbaum I think you can best help by writing a kubectl set which supports limits and requests in upstream kubernetes. It would eventually get pulled back into OSE. I don't think anyone is actually working on it. So please take it and run!

@eparis
Copy link
Member

eparis commented Apr 21, 2016

For this PR repurpose it to instead just set the defaults Ben indicated.

@eparis
Copy link
Member

eparis commented Apr 21, 2016

@JacobTanenbaum also if you can do a 3rd PR to mention in the router (and registry) docs that it is important for users to set requests/limits as appropriate. ...

@smarterclayton
Copy link
Contributor

@JacobTanenbaum please add your description of what you're going to do to
Proposal: First-generation of kubectl set * commands
kubernetes/kubernetes#21648 so that it's
tracked with the other changes.

On Thu, Apr 21, 2016 at 12:41 PM, Eric Paris [email protected]
wrote:

@JacobTanenbaum https://github.com/JacobTanenbaum also if you can do a
3rd PR to mention in the router (and registry) docs that it is important
for users to set requests/limits as appropriate. ...


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8495 (comment)

@JacobTanenbaum
Copy link
Contributor Author

@eparis is there a default for memory that we can agree on?

@eparis
Copy link
Member

eparis commented Apr 21, 2016

Stand up a router, look at how much it is using? Just pick that :)

@smarterclayton
Copy link
Contributor

For router CPU we should request at least half a core (i don't want to
cause 1 core systems to fail).

On Thu, Apr 21, 2016 at 3:08 PM, Eric Paris [email protected]
wrote:

Stand up a router, look at how much it is using? Just pick that :)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8495 (comment)

@eparis
Copy link
Member

eparis commented Apr 21, 2016

@JacobTanenbaum scratch what @smarterclayton just said. Go will 100 millicores (1/10 CPU) and however much ram you need from inspection.

@JacobTanenbaum JacobTanenbaum changed the title add --limits and --requests command line flag to oadm router add default resource requests to router creation Apr 25, 2016
@JacobTanenbaum
Copy link
Contributor Author

[test]

1 similar comment
@JacobTanenbaum
Copy link
Contributor Author

[test]

@@ -666,6 +667,11 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out io.Writer, cfg *
ReadinessProbe: readinessProbe,
ImagePullPolicy: kapi.PullIfNotPresent,
VolumeMounts: mounts,
Resources: kapi.ResourceRequirements{
Requests: kapi.ResourceList{kapi.ResourceCPU: resource.MustParse("100m"),
Copy link
Member

Choose a reason for hiding this comment

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

can you put a \n between the { and the kapi.... doesn't this fail gofmt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't fail gofmt but it does look better with that newline

This is a repurposing of my original pull request to add a default
resource request to router creation instead of settable resource
requests and limits.

100 millicores was an agreed upon default for CPU and I observed that
the basic router with no routes uses about 86MB of RAM and decided 256MB
was a good starting point for a request that allows ample room for
growth.
@eparis
Copy link
Member

eparis commented Apr 27, 2016

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Apr 27, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3362/) (Image: devenv-rhel7_4053)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 97195e3

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 97195e3

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3362/)

@openshift-bot openshift-bot merged commit f25834b into openshift:master Apr 27, 2016
@0xmichalis
Copy link
Contributor

@miminar we should do something similar for the registry

JacobTanenbaum added a commit to JacobTanenbaum/openshift-docs that referenced this pull request May 20, 2016
Pull request openshift/origin#8495 added default
resource request values for a router pod and that should be
mentioned in the documentation.
ahardin-rh pushed a commit to ahardin-rh/openshift-docs that referenced this pull request Jun 13, 2016
Pull request openshift/origin#8495 added default
resource request values for a router pod and that should be
mentioned in the documentation.
ahardin-rh pushed a commit to ahardin-rh/openshift-docs that referenced this pull request Jun 14, 2016
Pull request openshift/origin#8495 added default
resource request values for a router pod and that should be
mentioned in the documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants