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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip *heavy* validation on deletion 馃檭 #1085

Merged
merged 1 commit into from
May 11, 2021

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 vdemeest@redhat.com

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). The example that happen upgrading from 0.10.x to 0.12.x make EventListener not deletable at all.

/kind bug

Submitter Checklist

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

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

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/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 11, 2021
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_interceptor_validation.go 100.0% 90.9% -9.1
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go 66.7% 60.0% -6.7
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.8% 97.0% -0.7
pkg/apis/triggers/v1alpha1/trigger_binding_validation.go 100.0% 97.0% -3.0
pkg/apis/triggers/v1alpha1/trigger_template_validation.go 100.0% 97.1% -2.9
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.1% 92.9% -1.3

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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
@dibyom
Copy link
Member

dibyom commented May 11, 2021

This is great! Thanks! (Could we add a unit test?)

@vdemeester
Copy link
Member Author

This is great! Thanks! (Could we add a unit test?)

Yeah, I think we can 馃檭. Let me look 馃槈

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 11, 2021
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go 66.7% 80.0% 13.3
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.1% 94.3% 0.2

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 <vdemeest@redhat.com>
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go 66.7% 80.0% 13.3
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.1% 94.3% 0.2

@dibyom
Copy link
Member

dibyom commented May 11, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 11, 2021
@tekton-robot tekton-robot merged commit 689c7e7 into tektoncd:main May 11, 2021
@vdemeester vdemeester deleted the skip-validation-on-delete branch May 11, 2021 18:05
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.

None yet

3 participants