-
Notifications
You must be signed in to change notification settings - Fork 1.8k
WIP Set podTemplate on Tasks to enable multi-arch builds with Matrix #8599
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind feature |
The following is the coverage report on the affected files.
|
/assign |
@@ -119,6 +120,9 @@ type TaskSpec struct { | |||
// Results are values that this Task can output | |||
// +listType=atomic | |||
Results []TaskResult `json:"results,omitempty"` | |||
|
|||
// PodTemplate holds pod specific configuration | |||
PodTemplate *pod.PodTemplate `json:"podTemplate,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an example to the examples directory? They act as e2e tests as well and help validate if the given code is working properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly!
@@ -687,6 +687,13 @@ func ApplyReplacements(spec *v1.TaskSpec, stringReplacements map[string]string, | |||
container.ApplyStepTemplateReplacements(spec.StepTemplate, stringReplacements, arrayReplacements) | |||
} | |||
|
|||
// Apply variable expansion to podTemplate fields. | |||
if spec.PodTemplate != nil { | |||
for key, value := range spec.PodTemplate.NodeSelector { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the code very well there, but that only applies to the NodeSelector in the pod template; would there be more podtemplate specs that would needs to be applied here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chmouel Thanks for taking a look - yes I think it would make sense to support variable expansion in all of the podTemplate fields. Currently working on that and will push it up (hopefully) soon with some other updates.
if taskRun.Spec.PodTemplate != nil { | ||
podTemplate = *taskRun.Spec.PodTemplate | ||
} else if taskSpec.PodTemplate != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note here, I think this will ideally instead be a merge function that overrides only those values that the TaskRun defines instead of the whole podTemplate being replaced, but wanted to get others thoughts on this.
Changes
Hello! @jeffdyoung and I are working towards implementing the feature requested in: #6742, namely enabling Tekton to do builds on clusters with nodes of multiple architectures by enabling podTemplate to be set on Tasks.
This currently is an extremely basic approach without any of the supporting tests, validation, and other related code changes in order to show a proof of concept and get some feedback on the general approach before creating a TEP. This will of course later also be cleaned up to follow https://github.com/tektoncd/pipeline/blob/main/CONTRIBUTING.md.
These minimal changes do currently work to accomplish the goal, with an example Pipeline like:
Feedback appreciated, thanks!
Fixes #6742
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes