Skip to content
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

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

vaikas
Copy link
Contributor

@vaikas vaikas commented Apr 7, 2022

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:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 7, 2022
@tekton-robot tekton-robot requested review from jerop and pritidesai April 7, 2022 21:44
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/taskrun.go 79.9% 80.2% 0.3

Comment on lines 408 to 414
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)
Copy link
Member

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.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 15, 2022
@imjasonh imjasonh self-requested a review May 16, 2022 13:58
@imjasonh
Copy link
Member

@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? 🙏

@vaikas vaikas force-pushed the use-informer-for-pod branch from faf4c25 to 5f51365 Compare May 16, 2022 14:32
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/taskrun.go 80.1% 80.7% 0.6

@vdemeester
Copy link
Member

@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? pray

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.

Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Thanks Ville! 👍

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 16, 2022
@imjasonh
Copy link
Member

/test pull-tekton-pipeline-alpha-integration-tests

@vdemeester
Copy link
Member

/test pull-pipeline-kind-k8s-v1-21-e2e

@vdemeester vdemeester closed this Jun 2, 2022
@vdemeester vdemeester reopened this Jun 2, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/taskrun.go 80.3% 80.9% 0.6

@vaikas vaikas mentioned this pull request Jun 7, 2022
5 tasks
@vaikas
Copy link
Contributor Author

vaikas commented Jun 7, 2022

/test pull-pipeline-kind-k8s-v1-21-e2e

@vdemeester
Copy link
Member

/approve
/test .*

@tekton-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 8, 2022
@vdemeester
Copy link
Member

I am not sure what is happening with the kind job...

@vdemeester
Copy link
Member

/test pull-pipeline-kind-k8s-v1-21-e2e

@jerop
Copy link
Member

jerop commented Jun 15, 2022

/test pull-pipeline-kind-k8s-v1-21-e2e

@tekton-robot tekton-robot merged commit e96d7fc into tektoncd:main Jun 15, 2022
@afrittoli
Copy link
Member

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants