pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

Compress Runs' data before adding to annotations

Open concaf opened this issue 1 year ago β€’ 29 comments

Changes

When embedded-status is set to both or full, then TaskRun and PipelineRun payload JSON is added to annotations to facilitate conversion. This JSON payload is occasionally too large to fit into annotations and the maximum size limit of annotations (256 kB, combined limit for all annotations) is exceeded leading to errors while fetching Tekton workloads.

Example:

$ tkn pr ls
Failed to list objects from pipelines-ci namespace
Error: failed to list PipelineRuns from namespace pipelines-ci: conversion webhook for tekton.dev/v1beta1, Kind=PipelineRun returned invalid metadata: metadata.annotation: Too long: must have at most 262144 bytes

This commit mitigates this in 2 ways:

  • The JSON payload is compressed before adding to the annotations. This helps in reducing the size footprint of the annotations quite a bit. The data is further encoded after compression so as to sanitize the compressed data which is in binary.
  • Once the annotations are added, the size is validated and an error is returned if the annotions size limit is exceeded.

Fix #6561

Submitter Checklist

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

  • [x] Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • [x] Has Tests included if any functionality added or changed
  • [x] Follows the commit message standard
  • [x] Meets the Tekton contributor standards (including functionality, content, code)
  • [x] 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
  • [x] 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.
  • [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

concaf avatar Jul 25 '23 14:07 concaf

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/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 14:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 14:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 15:07 tekton-robot

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/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 15:07 tekton-robot

This PR is also targeting the release-0.44.x release branch. Is that intentional?

πŸ‘‹πŸΌ yes, i'm currently impacted on this release branch so i've sent a fix here, once this goes in i will cherry pick to main.

concaf avatar Jul 25 '23 15:07 concaf

As-is I think the change will break existing installations that already have their data stored as json (since as of v0.49.0 v1 is the storage version). We'll need to be able to handle both cases for backwards compatibility.

@wlynch during testing i found that the existing JSON data in pipelineruns was getting converted to the new compressed + decoded format πŸ€” not sure if that's the expected behavior though, and what might that break? πŸ€”

concaf avatar Jul 25 '23 15:07 concaf

/cc jerop who probably has more context on this than I do.

As-is I think the change will break existing installations that already have their data stored as json (since as of v0.49.0 v1 is the storage version). We'll need to be able to handle both cases for backwards compatibility.

This PR is also targeting the release-0.44.x release branch. Is that intentional?

So that's indeed the case but :

  1. This is only on 0.44.x (and above, until next LTS, so 0.47.x)
  2. There is "almost" nothing else using this (except the PipelineResource serialization to v1) elsewher
  3. We could, at deserialization, try to decode and if it doesn't work to unmarshall directly as a failover. That would make sure we can read both, but we always write wit the new format
  4. This targets 0.44.x as this is where we have our bug but this should be done on main as well. Either we cherry-pick from main to 0.44 or the opposite, I am fine with both πŸ‘ΌπŸΌ

vdemeester avatar Jul 25 '23 15:07 vdemeester

@wlynch during testing i found that the existing JSON data in pipelineruns was getting converted to the new compressed + decoded format not sure if that's the expected behavior though, and what might that break?

This is probably due to the fact that the storage version is v1beta1 in 0.44.x so.. it's never "stored" with the annotation, making it never stored (and thus, not a problem, in 0.44.x and all version that use v1beta1 as storage πŸ™ƒ )

vdemeester avatar Jul 25 '23 15:07 vdemeester

/kind bug

concaf avatar Jul 25 '23 18:07 concaf

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/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 18:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Jul 25 '23 18:07 tekton-robot

/retest

concaf avatar Jul 26 '23 11:07 concaf

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Oct 24 '23 12:10 tekton-robot

/remove-lifecycle stale need to fix

concaf avatar Nov 09 '23 10:11 concaf

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/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Nov 23 '23 10:11 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Nov 23 '23 10:11 tekton-robot

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/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.3% -0.4
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Nov 29 '23 14:11 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.3% -0.4
pkg/apis/version/conversion.go 81.2% 72.2% -9.0

tekton-robot avatar Nov 29 '23 14:11 tekton-robot

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/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 08 '23 12:12 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 08 '23 12:12 tekton-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign vdemeester after the PR has been reviewed. You can assign the PR to them by writing /assign @vdemeester in a comment when ready.

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

tekton-robot avatar Dec 09 '23 05:12 tekton-robot

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/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 09 '23 05:12 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 09 '23 05:12 tekton-robot

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/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 11 '23 12:12 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 11 '23 12:12 tekton-robot

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/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 11 '23 13:12 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 94.6% -1.1
pkg/apis/version/conversion.go 81.2% 72.1% -9.2

tekton-robot avatar Dec 11 '23 13:12 tekton-robot

@concaf: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-build-tests fd9d4e31ca5594b40c855e6e6102c0c31f8be77e link true /test pull-tekton-pipeline-build-tests
pull-tekton-pipeline-beta-integration-tests fd9d4e31ca5594b40c855e6e6102c0c31f8be77e link true /test pull-tekton-pipeline-beta-integration-tests
pull-tekton-pipeline-integration-tests fd9d4e31ca5594b40c855e6e6102c0c31f8be77e link true /test pull-tekton-pipeline-integration-tests
pull-tekton-pipeline-alpha-integration-tests fd9d4e31ca5594b40c855e6e6102c0c31f8be77e link true /test pull-tekton-pipeline-alpha-integration-tests

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.

tekton-robot avatar Dec 11 '23 13:12 tekton-robot

@concaf are you still working on this PR?

afrittoli avatar Feb 26 '24 12:02 afrittoli

pipeline WG @May 14th we can close this if support is no longer needed

JeromeJu avatar May 14 '24 16:05 JeromeJu