pipeline
pipeline copied to clipboard
PipelineRun 's PodTemplate support affinity
Feature request
currently, PipelineRun support PodTemplate only three feature: tolerations, nodeSelector, and imagePullSecrets. and I would like to see affinity be supported.
Use case
In my case, I prefer all the task running on the high performance node which I will label it. but PipelineRun scheduler doesn't support affinity.nodeAffinity.
and I cannot guarantee the high performance node will avalible all the time, so nodeSelector makes assumption too strong.
/assign
any update? @yuzp1996
any update? @yuzp1996
Hi! I will start working on this issue today.
Hi @lookis, Podtemplate supports affinity now. This document podtemplates could help you.
But if your PipelineRun contains PVC then affinity will be overwritten by affinity-assistant. https://github.com/tektoncd/pipeline/blob/55f044161a68d1ce7d7a07df4fa7cf6be10eafd5/pkg/internal/affinityassistant/transformer.go#L29
I tried and find two solutions to avoid being overwritten by affinity-assistant.
- delete PVC in your pipelinerun
- disable affinity-assistant by setting feature-flag disable-affinity-assistant to be true
@lookis For more information about Affinity Assistant, you can refer to this document https://tekton.dev/vault/pipelines-v0.16.3/workspaces/#specifying-workspace-order-in-a-pipeline-and-affinity-assistants.
@yuzp1996 I think it would be better to merge two configurations, that's what nodeAffinity.weight for.
It's no reason for pvc case not to prefer a better node, thought it may failed, that's why it's nodeAffinity rather than nodeSelector
@lookis Yes, I agree with you that merging the two configurations is the better approach. I made changes in my dev environment and tested some simple cases and everything seems to be working fine. Maybe tomorrow I will create the PullRequest because I need to add some unit tests and test some more complex cases.
PR https://github.com/tektoncd/pipeline/pull/5306 has merged /close
@yuzp1996: You can't close an active issue/PR unless you authored it or you are a collaborator.
In response to this:
PR https://github.com/tektoncd/pipeline/pull/5306 has merged /close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Thx for the PR.