tektoncd/pipeline
View on GitHubAllow to use variable replacement when defining resource limits and requests
Open
#4,080 opened on Jul 8, 2021
area/apidesignhelp wantedkind/featurelifecycle/frozenpriority/backlog
Repository metrics
- Stars
- (9,013 stars)
- PR merge metrics
- (PR metrics pending)
Description
Feature request
Consider this example Task:
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: resource-example
spec:
description: Sample Task to show issues with passing parameters to resources.
params:
- name: RESOURCE_MEMORY_REQUEST
type: string
default: 1Gi
- name: RESOURCE_MEMORY_LIMIT
type: string
default: 2Gi
steps:
- name: noop
image: registry.access.redhat.com/ubi8/ubi-minimal:8.2
resources:
requests:
memory: $(params.RESOURCE_MEMORY_REQUEST)
limits:
memory: $(params.RESOURCE_MEMORY_LIMIT)
When creating such a resource it fails with:
Error from server (BadRequest): error when creating "minimal-resource.yaml": admission webhook "webhook.pipeline.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'
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 :)