-
Notifications
You must be signed in to change notification settings - Fork 753
Add CPU limit argument to function commands #606
Add CPU limit argument to function commands #606
Conversation
04af1fd
to
016ad2b
Compare
cmd/kubeless/function/deploy.go
Outdated
@@ -209,6 +214,7 @@ func init() { | |||
deployCmd.Flags().StringP("trigger-topic", "", "", "Deploy a pubsub function to Kubeless") | |||
deployCmd.Flags().StringP("schedule", "", "", "Specify schedule in cron format for scheduled function") | |||
deployCmd.Flags().StringP("memory", "", "", "Request amount of memory, which is measured in bytes, for the function. It is expressed as a plain integer or a fixed-point interger with one of these suffies: E, P, T, G, M, K, Ei, Pi, Ti, Gi, Mi, Ki") | |||
deployCmd.Flags().StringP("cpu", "", "", "Request amount of cpu for the function.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might want to add a sample or some more words to explain the accepted format for the cpu number. https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
docs/autoscaling.md
Outdated
|
||
To autoscale based on CPU usage, it is *required* that your function has been deployed with CPU request limits. | ||
|
||
Do do this, use the `--cpu` parameter when deploying your function. Please see the [Meaning of CPU](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) for the format of the value that should be passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: To do this
I add few comments. The overall code lgtm. Would you like to keep this thread by adding commits to validate the |
if mem != "" { | ||
funcMem, err := parseMemory(mem) | ||
if mem != "" || cpu != "" { | ||
funcMem, err := parseResource(mem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that I follow, are both men
and cpu
required? With this code if one of the two values is not set the function will fail (trying to parse an empty string). Is that expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseResource
was changed to return an empty resources object if an empty string is passed as input - happy to change if you want but was the easiest way to get stuff working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, true, I missed that. It's okay then.
as @sebgoa suggested, we might want to add default cpu and memory limits if those flags aren't set |
@SomeoneWeird I thought that specifying a default for cpu and/or mem would avoid the situation that you faced. If we don't set default limits, a user might try to do the same as you to test auto-scaling and will think it does not work and will have to go on the same debugging spree as you did. |
@murali-reddy please comment |
@sebgoa I recommend that we also change |
Gotcha, yes that sounds good. No need for default limits then because the Folks might still be confused if they create an hpa by hand though but at least we can document it properly. thanks, let's merge once @murali-reddy gets his eyes on this |
Changes in this PR LGTM. On a seperate note I do think having default value make sense. What if some one writes a rogue function hogging memory and CPU? May be a discussion point for a sepearte issue/pr. |
I agree we should tackle that in a seperate issue 👍 |
* Add CPU limit argument to function commands * Fix doc typo * Add better description to --cpu argument
* Add CPU limit argument to function commands * Fix doc typo * Add better description to --cpu argument
* CRD API objects for functions, http, kafka, cronjob triggers and corresponding auto-generated informer, listers, clienset and deep copy generated function * CRD controllers for the function, kafka triggers, cronjob triggers, http triggers CRD objects. * new server side binaries kubeless-controller-manager and kafka-controller * updated CLI to incorporate implict creation of triggers with "kubeless function deploy" and move ingress object creation logic to http trigger controller * updated to build scripts * updated to manifests Co-authored-by: Andres <andres.mgotor@gmail.com> Co-authored-by: Tuna <ng.tuna@gmail.com> * Updates to examples used in integration tests Co-authored-by: Andres <andres.mgotor@gmail.com> Co-authored-by: Tuna <ng.tuna@gmail.com> * kafka even consumer with new go kafka lib dependencies Co-authored-by: Tuna <ng.tuna@gmail.com> * update vendor libs Co-authored-by: Tuna <ng.tuna@gmail.com> * update docker files Co-authored-by: Tuna <ng.tuna@gmail.com> Co-authored-by: Andres <andres.mgotor@gmail.com> * updates to utils and langruntime * update .travis.yaml * delete old controller docker file * better kafka even consumer logging * fix travis ci issue related to kafka broker * keep the old GKE version 1.7.12-gke.1 * Use bitnami-bot docker account * Fix http request method for the Kafka consumer * Push Kafka image * Fix content-type in consumer HTTP message * Fix GKE version * Removed duplicated files * Update runtime docs * Do proper check for topic update * skip IT test with trigger update through * Add CPU limit argument to function commands (#606) * Add CPU limit argument to function commands * Fix doc typo * Add better description to --cpu argument * fix glide.lock and vendor libs, that got messed up with master merge * addressing review comments * update .gitignore with new controller images * Review * Review * use 3-way merge Patch only to update the CRD objects * nodejs, remove runtime internal data from sandbox, avoid code concat (#633) * nodejs, remove runtime internal data from sandbox, avoid code concat * update according to comments * keep compatibility with module.exports * adjust kubeless.jsonnet * Move images to the kubeless repository * Revert "use 3-way merge Patch only to update the CRD objects" This reverts commit 358f8cb. * Avoid reflect.DeepEqual for deployment comparison * Fix empty body for NodeJS functions * fix GKE CI failures due to upstream issue kubernetes/kubernetes#60538 * Fix error catching in Python runtime. Remove old files * Send message as jsons if necessary in kafka-consumer * Move serviceSpec to function object. Fix service modifications
Issue Ref: #605
Description:
Adds
--cpu
argument tofunction deploy
andfunction update
to enable setting CPU limits, required for HPA.TODOs: