Skip to content

Conversation

@vdemeester
Copy link
Member

@vdemeester vdemeester commented May 11, 2021

Changes

When deleting an object, we don't need to pursue all the validation
that we do at creation. It reduces the work to be done as part of the
validation and allows invalid version of the resource (from previous
versions for example) to be deleted safely.

Signed-off-by: Vincent Demeester [email protected]

The main reasoning for this change is to not face issues to reduce the situation where an upgrade makes object not deletable (because of newly invalid field). One example that happen in triggers is upgrading from 0.10.x to 0.12.x make EventListener not deletable at all.

/kind bug

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 or deleted (only if no user facing changes)

Release Notes

Skip *heavy* validation on deletion in the webhook

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels May 11, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 11, 2021
@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/apis/pipeline/v1alpha1/condition_validation.go 90.0% 83.3% -6.7
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.8% 97.1% -0.7
pkg/apis/pipeline/v1alpha1/pipelinerun_validation.go 95.5% 91.7% -3.8
pkg/apis/pipeline/v1alpha1/run_validation.go 87.5% 83.3% -4.2
pkg/apis/pipeline/v1alpha1/task_validation.go 83.7% 82.8% -0.9
pkg/apis/pipeline/v1alpha1/taskrun_validation.go 89.8% 88.5% -1.3
pkg/apis/pipeline/v1beta1/pipeline_validation.go 100.0% 99.6% -0.4
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 100.0% 97.1% -2.9
pkg/apis/pipeline/v1beta1/task_validation.go 96.3% 95.2% -1.2
pkg/apis/pipeline/v1beta1/taskrun_validation.go 100.0% 97.6% -2.4
pkg/apis/resource/v1alpha1/pipelineresource_validation.go 90.2% 88.9% -1.3

@ghost
Copy link

ghost commented May 11, 2021

The main reasoning for this change is to not face issues to reduce the situation where an upgrade makes object not deletable (because of newly invalid field). One example that happen in triggers is upgrading from 0.10.x to 0.12.x make EventListener not deletable at all.

Nice. This has also hit me when I'm developing a new feature. Going back to the current HEAD of pipelines/main means that the taskruns with the new feature syntax cannot be deleted.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Cool. I don't think I've seen IsInDelete and related funcs from knative before.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbwsg

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 May 11, 2021
@imjasonh
Copy link
Member

Nice find!

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 11, 2021
@vdemeester
Copy link
Member Author

/hold
Let me add some simple unit tests 🙃

@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 May 11, 2021
@vdemeester vdemeester force-pushed the skip-validation-on-delete branch from c736283 to e67fce9 Compare May 12, 2021 09:31
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label May 12, 2021
@vdemeester vdemeester force-pushed the skip-validation-on-delete branch from e67fce9 to 2b01218 Compare May 12, 2021 09:31
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 12, 2021
@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/apis/pipeline/v1alpha1/condition_validation.go 90.0% 83.3% -6.7
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.8% 97.1% -0.7
pkg/apis/pipeline/v1alpha1/pipelinerun_validation.go 95.5% 91.7% -3.8
pkg/apis/pipeline/v1alpha1/run_validation.go 87.5% 83.3% -4.2
pkg/apis/pipeline/v1alpha1/task_validation.go 83.7% 82.8% -0.9
pkg/apis/pipeline/v1alpha1/taskrun_validation.go 89.8% 88.5% -1.3
pkg/apis/pipeline/v1beta1/task_validation.go 96.3% 97.0% 0.7
pkg/apis/resource/v1alpha1/pipelineresource_validation.go 90.2% 88.9% -1.3

@vdemeester
Copy link
Member Author

/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 May 12, 2021
@pritidesai
Copy link
Member

this is interesting, context tells you whether a resource is being deleted 😲

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 25, 2021
@nikhil-thomas
Copy link
Member

this is interesting, context tells you whether a resource is being deleted 😲

/lgtm

Thanks for pointing it out. 🧑‍💻 👍
very useful in tektoncd/operator work. 🙂

@pritidesai
Copy link
Member

would this work? 🤔

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

@vdemeester
Copy link
Member Author

/retest

When deleting an object, we don't need to pursue all the validation
that we do at creation. It reduces the work to be done as part of the
validation *and* allows invalid version of the resource (from previous
versions for example) to be deleted safely.

Signed-off-by: Vincent Demeester <[email protected]>
@vdemeester vdemeester force-pushed the skip-validation-on-delete branch from 2b01218 to 3926b66 Compare June 1, 2021 08:45
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 1, 2021
@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/apis/pipeline/v1alpha1/condition_validation.go 90.0% 83.3% -6.7
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.8% 97.1% -0.7
pkg/apis/pipeline/v1alpha1/pipelinerun_validation.go 95.5% 91.7% -3.8
pkg/apis/pipeline/v1alpha1/run_validation.go 95.8% 92.3% -3.5
pkg/apis/pipeline/v1alpha1/task_validation.go 83.7% 82.8% -0.9
pkg/apis/pipeline/v1alpha1/taskrun_validation.go 89.8% 88.5% -1.3
pkg/apis/pipeline/v1beta1/task_validation.go 96.3% 97.0% 0.7
pkg/apis/resource/v1alpha1/pipelineresource_validation.go 90.2% 88.9% -1.3

@vdemeester
Copy link
Member Author

/retest
Somehow the jobs got killed..

@pritidesai
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 2, 2021
@vdemeester
Copy link
Member Author

/retest

@tekton-robot tekton-robot merged commit a4d7f43 into tektoncd:main Jun 2, 2021
@vdemeester vdemeester deleted the skip-validation-on-delete branch June 2, 2021 07:53
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants