-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Allow to use variable replacement when defining resource limits and requests #4080
Comments
This is very useful for buildah or other image building tasks. Clusters with namespace resource quotas MUST have resource limits and requests defined. |
/assign |
keywords for search: variable substitution |
The |
Yeah I also figured this out. The resource.Quantity has a regex validator |
I came across this as I naively hoped to set the resource constraints via parameters. I think this feature is crucial as the place to decide the resource requirements is more likely the pipeline than the task. I guess the regex validator would need to allow a parameter reference then? |
WIP as the docs are out of date, and they cannot be updated because unmarshalling fails Tekton validation as noted in tektoncd/pipeline#4080. [ci skip]
Looks like a duplicate of #1530, which got closed without resolution |
Good point. Seems like #1548 is about the same problem as well. This is close to being a blocker for reusable tasks ... @bobcatfish Do you think this could be moved up in priority? Also - how can one help here? |
I've had to write automation to create tasks that only differ in the steps resources, so this would be very welcomed. I guess the problem here is that you have to move somewhere else the resources format check as it cannot be anymore in the Task admission webhook. |
Also, this produces a UX bug for $ kubectl get tasks
NAME AGE
echo-hello 9m50s
echo-hello-world 11m
$ tkn task ls
Error: failed to list Tasks from namespace default: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$' CC: @piyush-garg WDYT? |
/assign lbernick |
To summarize what previous commenters have said, and add a little more detail: I'm working on a PR to address this by replacing Step.Resources with a struct where Requests and Limits are maps of ResourceName -> string rather than ResourceName -> Quantity (thanks @bobcatfish for the suggestion!). Unfortunately this will require updates to the Tekton CLI and maybe dashboard, to update references to Other ways of doing this could be special casing param names (e.g. param "resources.requests.memory" is used to replace memory requests), the "patches" syntax suggested by @skaegi in #1530, or support specifying resource requests in TaskRuns, as requested in #4326. |
This TEP addresses tektoncd/pipeline#4080 and tektoncd/pipeline#4326 by proposing new configuration to TaskRuns and PipelineTaskRuns that can override any Step resource requirements specified in a Task or PipelineTask.
This TEP addresses tektoncd/pipeline#4080 and tektoncd/pipeline#4326 by proposing new configuration to TaskRuns and PipelineTaskRuns that can override any Step resource requirements specified in a Task or PipelineTask.
This TEP addresses tektoncd/pipeline#4080 and tektoncd/pipeline#4326 by proposing new configuration to TaskRuns and PipelineTaskRuns that can override any Step resource requirements specified in a Task or PipelineTask.
This TEP addresses tektoncd/pipeline#4080 and tektoncd/pipeline#4326 by proposing new configuration to TaskRuns and PipelineTaskRuns that can override any Step resource requirements specified in a Task or PipelineTask.
/remove-lifecycle stale See comment #4080 (comment) |
cc @ywluogg |
@michaelsauter have you checked out the remote pipelines feature? this was added in v0.35.0 and sounds a lot like what you're describing.
Is it fair to say that pipeline-level sidecars might be better to track in #4235? I'm not sure I understand how this relates to parameterizing resource requirements. An update since I last commented on this issue: we've updated our compatibility policy to clarify that we don't consider a change to the Go libraries a "breaking change" unless it also affects the yaml a user can specify. This means this issue can be tackled at any time, i.e. not tied to our v1 release. |
I have seen it! Unfortunately it doesn't quite fit what we do right now. We currently have a custom file in each repo which defines the pipeline, but also has other configuration. The pipeline is not described fully to avoid boilerplate - the user just references some tasks instead of providing a full
Totally, #4235 is the right place to track sidecars. You are right that it is unrelated from a tech/feature perspective to the issue here. However I believe it is related on a conceptual level. I believe both sidecars and resource requirements should be defined by the Pipeline(Run) author, not by the Task author. How I am thinking about it, ideally, I would be able to express this:
|
Just FYI about the new propagated parameters feature and upcoming propagated workspaces feature which are designed to reduce verbosity.
Thanks, this example is really helpful. In Tekton we have a concept of "authoring time" (Task/Pipeline) vs "runtime" (TaskRun/PipelineRun) and I think compute resources are something that should be specified at runtime; however, there is some precedent for specifying "runtime" related fields on Pipeline Tasks, e.g. timeout so this could make sense. Right now, we're implementing task-level resource requirements (example), and as part of the future work for this proposal one thing we are going to consider is deprecating Here's what I'm picturing for our eventual compute resources api (note that none of this is set in stone, it's just my personal opinion about how things should look and will depend on feedback on task-level compute resources; also I'm hoping we can standardize on "computeResources" rather than "resources"):
or on a PipelineRun:
It could be totally reasonable to have If we do choose to remove |
While I generally agree with the distinction, I think that We have been thinking to simply create PipelineRuns instead of Pipelines from our config file, in order to move into the "runtime", but the downside of that is that e.g. grouping of runs in the UI is lost (we're using the OpenShift console).
My understanding though is that |
Thanks Michael for continuing to help me understand what you're looking for here! I think what you're requesting is actually a bit different from what the original author of this issue was requesting, so I opened #5110 to track your FR. PTAL and feel free to add any details I missed. That along with #4235 should cover your FRs IMO, so I'm going to close this issue, but feel free to reopen if you're specifically looking for parameterization of resource requirements. |
I would actually love to see this issue reopened. |
I guess you can just use stepOverride |
I am not really sure how that works.. At which point do you specify the stepOverride and when is it evaluated? Or were you thinking along the lines of just starting a task run from the trigger template, which then fetches the file from our git server and then creates a pipeline run with the proper parameters set? |
I was thinking you could specify the pipelinerun in your triggertemplate like this:
To clarify, do you store compute resource configuration by itself in the repo, and want your PipelineRun to read that info in one TaskRun and spawn subsequent TaskRuns with the right compute resources? Or are you interested in specifying compute resource configuration on Tekton resources stored in a repo? I'm not sure how we'd support the former feature but it's not currently supported. (There may be some hacks like having your taskrun call the k8s api to create other taskruns, but this obviously isn't a great ux.) For the latter feature, you might be interested in remote resolution in Triggers (tektoncd/triggers#1539). |
We have the first use case. We set it up such that pipelines and tasks are in one repository, and lots of different projects use these pipelines. These projects are e.g. dotnet backends, and have their own repository. We already allow the project teams to place a configuration file in their repositories, which we then evaluate during the pipelinerun (with a task simply reading values from this file, which was previously fetched via git clone) and store them as results of the task. Follow up tasks then reference these results e.g. for the image that should be used, or to determine if certain other steps should be taken. apiVersion: tekton.dev/v1
kind: PipelineRun
spec:
taskRunSpecs: # taskRunTemplate could also be used here
- pipelineTaskName: expensive-build-step
stepSpecs:
- name: build
computeResources:
requests:
memory: $(tasks.get-params.results.requests_memory)
cpu: $(tasks.get-params.results.requests_cpu)
limits:
memory: $(tasks.get-params.results.limits_memory)
cpu: $(tasks.get-params.results.limits_cpu) but (without having tested it) I think this wont work as those results will only be around after the get-params task was executed. |
@leoffj that's correct. It sounds like this is a use case for parameterizing resource requirements that's not met by existing/substitute features, so I'll reopen this issue. Thanks! |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
/lifecycle frozen |
Really, Really need this function, please. |
Feature request
Consider this example Task:
When creating such a resource it fails with:
This suggests that webhook is not able to decipher what is the value. And since the value is correct, it should be allowed to do use it this way.
Use case
Main use case is to dynamically change requests and resources based on the runtime requirements. I consider this as a workaround for general lack of a nice way to do it otherwise. But even the workaround doesn't work currently :)
The text was updated successfully, but these errors were encountered: