-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix PipelineRun serviceAccountNames for finally tasks #3560
Merged
tekton-robot
merged 2 commits into
tektoncd:master
from
ljupchokotev:finally-task-sa-mapping
Dec 1, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Interesting, this is a miss when we deprecated
ServiceAccountNames
🤔 it shouldn't be looking here (or at least it should be sharing the same code as what the reconciler does)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 am still trying to understand this but it looks a bit weird so far 😕
Reconciler runs validation on
pipelineRun.Spec.ServiceAccountNames
andpipelineRun.Spec.taskRunSpecs
, making sure the tasks specified in these sections exist undertasks
andfinally
:pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Line 443 in 4fdd018
and
pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Line 451 in 4fdd018
But,
resolvePipelineState
resolves task withpr.Spec.ServiceAccountName
:pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Line 471 in 4fdd018
pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Line 266 in 4fdd018
Only applies to
bundle
at this point, i.e. bundles does not honorpr.Spec.ServiceAccountNames
orpr.Spec.TaskRunSpecs
🤔pipeline/pkg/reconciler/taskrun/resources/taskref.go
Line 53 in 4fdd018
Looking further 🔍
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.
alright,
createTaskRun
resolves service account name in expected order:pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Line 654 in 4fdd018
First, read serviceAccountName specified in
pr.Spec.ServiceAccountNames
:pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go
Line 141 in 4fdd018
which get replaced with
pr.Spec.TaskRunSpecs
if specified:pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_types.go
Lines 438 to 439 in 4fdd018
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.
It's looking here to validate which is fine from the validation perspective, reconciler reads
serviceAccountName
,serviceAccountNames
, andtaskRunSpecs
, and sets the service account name in expected order.