Problem
Affinity-assistant pods have hardcoded resource requirements that cannot be customized:
// pkg/reconciler/pipelinerun/affinity_assistant.go:331-339
Resources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": resource.MustParse("50m"),
"memory": resource.MustParse("100Mi"),
},
Requests: corev1.ResourceList{
"cpu": resource.MustParse("50m"),
"memory": resource.MustParse("100Mi"),
},
}
This causes issues in environments with ResourceQuota policies:
- Resource Contention: Hardcoded values may be insufficient or excessive
- Quota Exhaustion: Minimal AA pods still consume quota needed for workloads
- LimitRange Conflicts: Namespace LimitRanges may prevent pod creation
- Inflexibility: No tuning based on cluster size or workload needs
Use Case
Red Hat OpenShift Pipelines customers with strict ResourceQuota policies need to customize affinity-assistant resources to match quota constraints and prevent scheduling failures (#8015, #3049).
Proposed Solution
Add Resources field to AffinityAssistantTemplate, following the pattern from #2679:
type AffinityAssistantTemplate struct {
NodeSelector map[string]string
Tolerations []corev1.Toleration
ImagePullSecrets []corev1.LocalObjectReference
SecurityContext *corev1.PodSecurityContext
PriorityClassName *string
Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // NEW
}
Configuration examples:
Global default:
default-affinity-assistant-pod-template: |
resources:
requests:
cpu: "50m"
memory: "100Mi"
limits:
cpu: "100m"
memory: "200Mi"
Per-PipelineRun override:
spec:
taskRunTemplate:
podTemplate:
resources:
requests:
cpu: "100m"
memory: "200Mi"
Implementation
- Update
AffinityAssistantTemplate struct
- Update
MergeAAPodTemplateWithDefault() merge logic
- Apply resources in
affinityAssistantStatefulSet()
- Add validation (requests ≤ limits)
- Maintain backward compatibility (current hardcoded values as defaults)
- Update docs and generate OpenAPI schemas
Alternatives Considered
- Extend
default-container-resource-requirements: Inconsistent with AffinityAssistantTemplate pattern
- LimitRange: Already available; applies to all pods (not targeted)
- MutatingAdmissionWebhook: Over-engineered
- Environment variables: Anti-pattern
Related Issues
Benefits
- Flexibility for different cluster configurations
- ResourceQuota compatibility
- Follows existing AffinityAssistantTemplate pattern
- Backward compatible
- Kubernetes-native
Implementation Offer
Red Hat OpenShift Pipelines team is willing to contribute this implementation if the community agrees with the approach.
Questions
- Does this align with Tekton's AA configuration vision?
- Should this go through the TEP process (API change)?
- Beta feature flag before stabilization?
cc @tektoncd/core-maintainers
Problem
Affinity-assistant pods have hardcoded resource requirements that cannot be customized:
This causes issues in environments with ResourceQuota policies:
Use Case
Red Hat OpenShift Pipelines customers with strict ResourceQuota policies need to customize affinity-assistant resources to match quota constraints and prevent scheduling failures (#8015, #3049).
Proposed Solution
Add
Resourcesfield toAffinityAssistantTemplate, following the pattern from #2679:Configuration examples:
Global default:
Per-PipelineRun override:
Implementation
AffinityAssistantTemplatestructMergeAAPodTemplateWithDefault()merge logicaffinityAssistantStatefulSet()Alternatives Considered
default-container-resource-requirements: Inconsistent with AffinityAssistantTemplate patternRelated Issues
Benefits
Implementation Offer
Red Hat OpenShift Pipelines team is willing to contribute this implementation if the community agrees with the approach.
Questions
cc @tektoncd/core-maintainers