tektoncd/pipeline
Allow to use variable replacement when defining resource limits and requests
开放
#4,080 创建于 2021年7月8日
area/apidesignhelp wantedkind/featurelifecycle/frozenpriority/backlog
仓库指标
- 星标
- (9,013 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
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 :)