-
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
Remove Updating labels and annotations… #6127
Remove Updating labels and annotations… #6127
Conversation
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.
Love it!
/lgtm
|
||
// Propagate annotations from Pipeline to PipelineRun. PipelineRun annotations take precedences over Pipeline. | ||
pr.ObjectMeta.Annotations = kmap.Union(meta.Annotations, pr.ObjectMeta.Annotations) | ||
// // Propagate labels from Pipeline to PipelineRun. PipelineRun labels take precedences over Pipeline. |
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.
These can just be dropped?
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.
From there yes, overall no as written in the PR description.
Even if this PR propose to remove this "feature", we still want the same behavior (aka a
Pod
gets its labels from both theTask
and theTaskRun
). Because we are only "caching" the spec of theTask
inTaskRun.status
(and same goes forPipelineRun
), we would have to query the metadata for theTask
each time. Using informers, it wouldn't cost that much, but we would run the same possible race as we did before and that's the reason we useTaskRun.status
andPipelineRun.status
as source of truth for the spec in all reconciler loop for a given object.So the question is the following : Where should we store the
Task
(andPipeline
forPipelineRun
) labels and annotations in aTaskRun
object ? Because we have already releasev1
, we can only do "additive" changes, so, most likely, the only way would be to have ataskMetadata
field in thestatus
in addition totaskSpec
.
But I am curious if anyone has any other ideas 👼🏼.
I'm curious why we can't separate out the labels/annotations propagation from the fix to #5146? i.e. if we just remove the call to update, and modify the labels of the TR/PR object passed to ReconcileKind, will knative update the object with the new metadata? Or does it only handle status updates? Also want to better understand the race condition you're referring to. My understanding is that if a Task's labels change, we will re-reconcile the TaskRun, and update the TaskRun with the Task's new labels (and likewise for PipelineRuns). The issue described in #5297 was the PipelineRun controller replacing labels, but we've updated it to merge labels. Can you give an example scenario where the race condition you're describing occurs? |
@lbernick As you "hinted" in one of your question, this is because it only update the status 👼🏼. It doesn't update anything else (metadata or spec). The take on updating only the status is that, users are supposed to interact with
If a Task label's change, it changes, nothing get's "reconciled" whatsoever. #5297 was not really "removing" things but overriding the content of the labels we "got" at the begining of the reconciler loop, even if, in the meantime, the |
Makes sense! I understand why you wouldn't want a controller to update the object's spec but why would it be bad for the controller to update labels? @imjasonh is there a recommended alternative pattern to use?
I'm not sure why I said this 🤦♀️ Curious if label changes in general trigger re-reconciles though?
Makes sense, thanks for the explanation! I'm not sure off the top of my head of any solutions other than adding |
It would on the object(s) that are watched, so |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
/remove-lifecycle rotten |
6852977
to
996f60f
Compare
New changes are detected. LGTM label has been removed. |
[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 |
Updated this, aside from some tests to be rewritten, it should be ready for review. /kind enhancement |
@vdemeester: The label(s) In response to this:
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. |
/kind bug |
996f60f
to
9b4285b
Compare
Labels and Annotations on PipelineRun and TaskRun won't be mutated by the controller anymore. Usually, a controller doesn't modify the metadata of the object it reconcile. This effectively remove the propagation of annotations and labels from Task to TaskRun, and Pipeline to PipelineRun. Instead, it stores the Task or Pipeline metadata in the corresponding status field (`Status.PipelineMeta` for PipelineRun, and `Status.TaskMeta` for TaskRun). Merging the two is done at the "lower" object creation (aka when creating the `TaskRun` from `PipelineRun` or when creating the `Pod` from `TaskRun`). Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
9b4285b
to
c9831eb
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
@vdemeester: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
@vdemeester: PR needs rebase. 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. |
Label propagation also causes issues with ArgoCD e.g |
Changes
Labels and Annotations on PipelineRun and TaskRun won't be mutated by the controller anymore. Usually, a controller doesn't modify the metadata of the object it reconcile.
This effectively remove the propagation of annotations and labels from Task to TaskRun, and Pipeline to PipelineRun.
This is an "attempt" to fix #5146 but it is mainly opened to start some discussion around it. Mainly the following :
One feature that we "want" is that labels and annotations from a
Task
and aTaskRun
are both inherited by thePod
. Same goes forPipelineRun
. Prior to this change, we get away with it by merging it at theTaskRun
orPipelineRun
level — which cause issues in the past (and still might), like #5297.Even if this PR propose to remove this "feature", we still want the same behavior (aka a
Pod
gets its labels from both theTask
and theTaskRun
). Because we are only "caching" the spec of theTask
inTaskRun.status
(and same goes forPipelineRun
), we would have to query the metadata for theTask
each time. Using informers, it wouldn't cost that much, but we would run the same possible race as we did before and that's the reason we useTaskRun.status
andPipelineRun.status
as source of truth for the spec in all reconciler loop for a given object.So the question is the following : Where should we store the
Task
(andPipeline
forPipelineRun
) labels and annotations in aTaskRun
object ? Because we have already releasev1
, we can only do "additive" changes, so, most likely, the only way would be to have ataskMetadata
field in thestatus
in addition totaskSpec
.But I am curious if anyone has any other ideas 👼🏼.
/cc @imjasonh @afrittoli @abayer @lbernick @jerop @chuangw6
Signed-off-by: Vincent Demeester vdemeest@redhat.com
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes