Skip to content

Conversation

@Pangjiping
Copy link
Contributor

@Pangjiping Pangjiping commented Jan 18, 2026

Changes

We deployed Tekton/Pipeline in a full DevOps environment, creating/deleting approximately four million resources weekly. As business complexity grows, the cluster accumulates large PipelineRun objects (Child TaskRuns > 64), causing severe stability issues with apiserver memory spikes and high write QPS for PipelineRun objects. We identified that the unsorted childRef array in PipelineRun status triggered massive redundant writes. Implementing array sorting significantly mitigates this issue.

  • apiserver write qps change:
image image
  • apiserver instance memory usage change:
image

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

- fix the issue of massive invalid status updates caused by unordered arrays, which will greatly impact the resource load and stability of the apiserver.

…sed by unordered arrays, which will greatly impact the resource load and stability of the apiserver.
@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Jan 18, 2026
@tekton-robot tekton-robot requested review from jerop and khrm January 18, 2026 03:45
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 18, 2026
@Pangjiping
Copy link
Contributor Author

/kind bug

@tekton-robot tekton-robot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Jan 18, 2026
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

Can you remove cmpopts.SortSlices from pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go? It's not needed anymore and will act as a test..

@Pangjiping
Copy link
Contributor Author

cmpopts.SortSlices from pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go

Nice suggestion. I removed the unnecessary sorting in pipelinerun_updatestatus_test.go to ensure the consistency of this modification.

@Pangjiping Pangjiping requested a review from khrm January 19, 2026 07:41
@khrm
Copy link
Contributor

khrm commented Jan 19, 2026

/lgtm

/assign @waveywaves @vdemeester

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2026
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.

/hold

To let @afrittoli @waveywaves and @twoGiants to look into it. Thank you for this PR !
I initially thought it could be a problem from the API point of view, but as there was no guarantee it was sorted before..

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 19, 2026
@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

Details 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 Jan 19, 2026
@vdemeester
Copy link
Member

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 21, 2026
@tekton-robot tekton-robot merged commit 0133513 into tektoncd:main Jan 21, 2026
25 checks passed
@vdemeester
Copy link
Member

/cherry-pick release-v1.0.x release-v1.3.x release-v1.6.x

@tekton-robot
Copy link
Collaborator

Cherry-pick to release-v1.3.x successful!

A new pull request has been created to cherry-pick this change to release-v1.3.x.

Please review and merge the cherry-pick PR.

@tekton-robot
Copy link
Collaborator

Cherry-pick to release-v1.0.x successful!

A new pull request has been created to cherry-pick this change to release-v1.0.x.

Please review and merge the cherry-pick PR.

@tekton-robot
Copy link
Collaborator

Cherry-pick to release-v1.6.x successful!

A new pull request has been created to cherry-pick this change to release-v1.6.x.

Please review and merge the cherry-pick PR.

@vdemeester
Copy link
Member

/cherry-pick release-v1.6.x

@tekton-robot
Copy link
Collaborator

Cherry-pick to release-v1.6.x failed!

The automatic cherry-pick to release-v1.6.x failed.

Output:

🤖 Starting cherry-pick process...
Fetching PR #9295 information...
Found merge commit: 0133513db03dadb3cb08801d6b0330badcb63830
PR title: fix(pipelinerun): fix the issue of massive invalid status updates caused by unordered arrays, which will greatly impact the resource load and stability of the apiserver.
Fetching target branch: release-v1.6.x...
From https://github.com/tektoncd/pipeline
 * branch                release-v1.6.x -> FETCH_HEAD
Checking for existing cherry-pick PR...
Creating cherry-pick branch: cherry-pick-9295-to-release-v1.6.x...
Switched to a new branch 'cherry-pick-9295-to-release-v1.6.x'
branch 'cherry-pick-9295-to-release-v1.6.x' set up to track 'origin/release-v1.6.x'.
Fetching commits from PR #9295...
Found 2 commit(s) to cherry-pick
Cherry-picking commit 1/2: 6e759e22f654b109673f9bb9383152979578a647...
fatal: bad object 6e759e22f654b109673f9bb9383152979578a647
❌ ERROR: Cherry-pick failed for commit 6e759e22f654b109673f9bb9383152979578a647 due to conflicts or other errors

Next steps:

  • Check the action logs for complete details
  • If the PR is not merged, merge it first and try again
  • If there are conflicts, you'll need to manually cherry-pick this PR

vdemeester added a commit to vdemeester/tektoncd-pipeline that referenced this pull request Feb 4, 2026
The previous cherry-pick (tektoncd#9314) only included the test file changes
(removing cmpopts.SortSlices) but not the actual sorting logic in
pipelinerun.go. This caused tests to fail because they expected sorted
output but the production code wasn't sorting.

This commit adds the missing sort.Slice call that sorts childRefs by
PipelineTaskName, then Name, then Kind to prevent excessive status
updates caused by unordered arrays.

Cherry-pick of the missing part from tektoncd#9295.

Signed-off-by: Vincent Demeester <[email protected]>
Co-Authored-By: Claude <[email protected]>
vdemeester added a commit to vdemeester/tektoncd-pipeline that referenced this pull request Feb 4, 2026
The previous cherry-pick (tektoncd#9312) only included the test file changes
(removing cmpopts.SortSlices) but not the actual sorting logic in
pipelinerun.go. This caused tests to fail because they expected sorted
output but the production code wasn't sorting.

This commit adds the missing sort.Slice call that sorts childRefs by
PipelineTaskName, then Name, then Kind to prevent excessive status
updates caused by unordered arrays.

Cherry-pick of the missing part from tektoncd#9295.

Signed-off-by: Vincent Demeester <[email protected]>
Co-Authored-By: Claude <[email protected]>
vdemeester added a commit that referenced this pull request Feb 4, 2026
The test file changes from #9295 were cherry-picked but the actual
sorting logic in pipelinerun.go was missing. This adds the sort.Slice
call that ensures childRefs are sorted by PipelineTaskName, then Name,
then Kind, preventing excessive apiserver status updates caused by
non-deterministic map iteration order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
vdemeester added a commit that referenced this pull request Feb 4, 2026
The test file changes from #9295 were cherry-picked but the actual
sorting logic in pipelinerun.go was missing. This adds the sort.Slice
call that ensures childRefs are sorted by PipelineTaskName, then Name,
then Kind, preventing excessive apiserver status updates caused by
non-deterministic map iteration order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
vdemeester added a commit that referenced this pull request Feb 4, 2026
The test file changes from #9295 were cherry-picked but the actual
sorting logic in pipelinerun.go was missing. This adds the sort.Slice
call that ensures childRefs are sorted by PipelineTaskName, then Name,
then Kind, preventing excessive apiserver status updates caused by
non-deterministic map iteration order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
vdemeester added a commit that referenced this pull request Feb 4, 2026
The test file changes from #9295 were cherry-picked but the actual
sorting logic in pipelinerun.go was missing. This adds the sort.Slice
call that ensures childRefs are sorted by PipelineTaskName, then Name,
then Kind, preventing excessive apiserver status updates caused by
non-deterministic map iteration order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
tekton-robot pushed a commit that referenced this pull request Feb 4, 2026
The test file changes from #9295 were cherry-picked but the actual
sorting logic in pipelinerun.go was missing. This adds the sort.Slice
call that ensures childRefs are sorted by PipelineTaskName, then Name,
then Kind, preventing excessive apiserver status updates caused by
non-deterministic map iteration order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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/bug Categorizes issue or PR as related to a bug. 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

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants