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

Don't rely on .status.podName to find Pod associated with a TaskRun #1709

Merged
merged 1 commit into from
Dec 16, 2019

Conversation

imjasonh
Copy link
Member

@imjasonh imjasonh commented Dec 9, 2019

This adds Reconciler.getPod, which looks up the Pod for a TaskRun by
performing a label selector query on Pods, looking for the label we
apply to Pods generated by TaskRuns.

If zero Pods are returned, it's the same as .status.podName being "". If
multiple Pods are returned, that's an error.

Also, clean up metrics_test.go a bit while I'm in that area.

This moves us toward clients of Tekton querying Pods owned by TaskRuns, instead of the ownership information being "owned" by the TaskRun. Eventually, someday, TaskRuns might not have Pods at all, and internal code and clients not relying on this behavior will make that easier to

/hold work-in-progress

#1689

cc @vdemeester @hrishin

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

TaskRuns identify Tekton-owned Pods using label selectors, instead of relying on the value of .status.podName. This valus is still provided in case clients rely on its presence.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Dec 9, 2019
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 9, 2019
@afrittoli
Copy link
Member

This will need a rebase @imjasonh

@afrittoli
Copy link
Member

Should we include a deprecation notice for this? I guess the plan is to drop .status.podName eventually?
We should probably get linked items in the CLI and Dashboard to start working on this.

@imjasonh
Copy link
Member Author

Should we include a deprecation notice for this? I guess the plan is to drop .status.podName eventually?
We should probably get linked items in the CLI and Dashboard to start working on this.

This change doesn't directly impact external users, it just changes how the controller identifies a TaskRun's pod. If this is not a regression (performance or behavior) we can switch the CLI and dashboard to use this method too. At that point we can decide whether to (sloooowly) deprecate .status.podName, but that's probably at least a few changes away from even being possible.

There isn't a lot of directly applicable benefit from doing this, at least not right now. In general the CLI/dashboard shouldn't have to rely on the fact of a Pod existing to stream logs, that's all.

But this change by itself should be invisible to end users or downstream clients.

@imjasonh imjasonh force-pushed the podname branch 2 times, most recently from edbf13a to da288e0 Compare December 10, 2019 19:01
@hrishin
Copy link
Member

hrishin commented Dec 11, 2019

@imjasonh shall I fix unit tests for it? Looks like metrics unit tests giving some trouble here.

@imjasonh
Copy link
Member Author

@hrishin Yeah if that failure makes any sense to you any help would be appreciated. I'd love to have metrics not fail constantly in tests, they don't cause problems at HEAD but they do spam error messages in logs (#1617).

@hrishin hrishin mentioned this pull request Dec 11, 2019
@hrishin
Copy link
Member

hrishin commented Dec 11, 2019

Yes, @imjasonh will reduce the that spamming as well. (really my bad, thank you for being patient on this 🙏)

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

  • the metrics_test.go is kinda unrelated to the PR but meh 🤓
  • with that change, we query the api way more (for pod), do you think it will affect performance heavily ? (I don't think so but…)

@imjasonh
Copy link
Member Author

I haven't noticed any serious performance regression, but under load or with millions of pods to query, it's possible it will be more noticeable.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/meow
/cc @bobcatfish @sbwsg

@tekton-robot tekton-robot requested a review from a user December 12, 2019 16:13
@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

/meow
/cc @bobcatfish @sbwsg

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.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2019
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

This adds Reconciler.getPod, which looks up the Pod for a TaskRun by
performing a label selector query on Pods, looking for the label we
apply to Pods generated by TaskRuns.

If zero Pods are returned, it's the same as .status.podName being "". If
multiple Pods are returned, that's an error.

Also, clean up metrics_test.go a bit while I'm in that area
@imjasonh
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2019
@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 merged commit 0f20c35 into tektoncd:master Dec 16, 2019
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. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants