-
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
Use informer for pod get/list instead of talking to API server. #4740
Conversation
The following is the coverage report on the affected files.
|
pkg/reconciler/taskrun/taskrun.go
Outdated
labelSelector := labels.Everything() | ||
myTaskLabelSelector, err := labels.NewRequirement(pipeline.TaskRunLabelKey, selection.Equals, []string{tr.Name}) | ||
if err != nil { | ||
logger.Errorf("Failed to construct a label selector for %s = %s", pipeline.TaskRunLabelKey, tr.Name) | ||
return err | ||
} | ||
labelSelector = labelSelector.Add(*myTaskLabelSelector) |
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 think you can do something tighter here with labels.SelectorFromSet
where labels.Set
is just a map[string]string
where you can say labels.Set{pipeline.TaskRunLabelKey: tr.Name}
and avoid the error path above entirely.
@vdemeester @afrittoli Was it a conscious decision to avoid the informer cache here? I seem to recall there being races and flakes, but I think they may have been solved by the change that renamed pods so they were more uniformly mapped to taskrun names. Can we avoid direct API calls here now? 🙏 |
Signed-off-by: Ville Aikas <[email protected]>
faf4c25
to
5f51365
Compare
The following is the coverage report on the affected files.
|
Yeah I don't fully remember the reason, but I have a similar vague idea that it was that, and I also think it might have been fixed by the pod name being uniformly set now. |
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.
/lgtm
Thanks Ville! 👍
/test pull-tekton-pipeline-alpha-integration-tests |
/test pull-pipeline-kind-k8s-v1-21-e2e |
The following is the coverage report on the affected files.
|
/test pull-pipeline-kind-k8s-v1-21-e2e |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I am not sure what is happening with the kind job... |
/test pull-pipeline-kind-k8s-v1-21-e2e |
/test pull-pipeline-kind-k8s-v1-21-e2e |
/kind misc |
Signed-off-by: Ville Aikas [email protected]
Changes
Instead of talking to API server for List/Get related to pods, use informer.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
(if there are no user facing changes, use release note "NONE")
Release Notes