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

DryRunValidate returns the mutated object #8108

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

chitrangpatel
Copy link
Contributor

@chitrangpatel chitrangpatel commented Jul 9, 2024

Prior to this, when validating remotely resolved resources, we performed a dry run. When a dry run is performed, the resource is passed through the mutating webhook admission controllers followed by the validating webhook controllers. We only validated the object and inserted the spec of the original object instead of the mutated object. This means that if users have mutating webhook controllers on their cluster then remotely resolved resources are not mutated when passed to the taskrun/pipelinerun. This PR fixes that.

Fixes #8071

Changes

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

DryRunValidate returns the mutated object

/kind bug

@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 Jul 9, 2024
@tekton-robot tekton-robot requested review from dibyom and vdemeester July 9, 2024 19:20
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 9, 2024
@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/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.8% -2.4

@chitrangpatel chitrangpatel force-pushed the return-mutated-object branch from 83c4286 to 7e72c94 Compare July 9, 2024 19:32
@tekton-robot
Copy link
Collaborator

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/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.8% -2.4

@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.8% -2.4

@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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.8% -2.4

@chitrangpatel chitrangpatel force-pushed the return-mutated-object branch from 7e72c94 to 94e9b55 Compare July 10, 2024 14:37
@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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.2% -3.0

@chitrangpatel chitrangpatel added this to the Pipeline v0.62 milestone Jul 10, 2024
@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.2% -3.0

@tekton-robot
Copy link
Collaborator

[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 Jul 11, 2024
// Issue a dry-run request to create the remote Pipeline, so that it can undergo validation from validating admission webhooks
// without actually creating the Pipeline on the cluster.
if err := apiserver.DryRunValidate(ctx, namespace, obj, tekton); err != nil {
// Issue a dry-run request to create the remote Task, so that it can undergo validation from validating admission webhooks
Copy link
Member

Choose a reason for hiding this comment

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

NIT: was the original comment valid?

Issue a dry-run request to create the remote Pipeline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. copy-paste error 😅 Fixing.

@pritidesai
Copy link
Member

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/reconciler/pipelinerun/resources/pipelineref.go 94.3% 91.8% -2.5
pkg/reconciler/taskrun/resources/taskref.go 94.2% 91.2% -3.0

It would be great to maintain the code coverage.

@chitrangpatel chitrangpatel force-pushed the return-mutated-object branch 2 times, most recently from 8382ac9 to 3e38d31 Compare July 17, 2024 14:12
@pritidesai
Copy link
Member

thanks @chitrangpatel
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2024
@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@chitrangpatel chitrangpatel force-pushed the return-mutated-object branch from 3e38d31 to deea321 Compare July 17, 2024 14:47
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2024
@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@chitrangpatel
Copy link
Contributor Author

/retest

1 similar comment
@chitrangpatel
Copy link
Contributor Author

/retest

@chitrangpatel
Copy link
Contributor Author

the integration tests are failing because we hit the Docker pull rate limit:

GET https://index.docker.io/v2/library/busybox/manifests/sha256:1303dbf110c57f3edf68d9f5a16c082ec06c4cf7604831669faf2c712260b5a0:
              TOOMANYREQUESTS: You have reached your pull rate limit. You may increase the

@chitrangpatel
Copy link
Contributor Author

/retest

1 similar comment
@chitrangpatel
Copy link
Contributor Author

/retest

@pritidesai
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2024
@chitrangpatel
Copy link
Contributor Author

/retest

1 similar comment
@chitrangpatel
Copy link
Contributor Author

/retest

Prior to this, when validating remotely resolved resources,
we performed a dry run. When a dry run is performed, the resource
is passed through the mutating webhook admission controllers followed by
the validating webhook controllers. We only validated the object and
inserted the spec of the original object instead of the mutated object.
This means that if users have mutating webhook controllers on their
cluster then remotely resolved resources are not mutated when passed to
the taskrun/pipelinerun. This PR fixes that.

Fixes tektoncd#8071
@chitrangpatel chitrangpatel force-pushed the return-mutated-object branch from deea321 to 2329d1a Compare July 18, 2024 01:53
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 18, 2024
@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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@tekton-robot
Copy link
Collaborator

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/reconciler/apiserver/apiserver.go 97.6% 98.1% 0.5
pkg/reconciler/pipelinerun/resources/pipelineref.go 94.3% 94.9% 0.6
pkg/reconciler/taskrun/resources/taskref.go 94.2% 94.2% -0.0

@chitrangpatel
Copy link
Contributor Author

/retest

@pritidesai
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 18, 2024
@pritidesai
Copy link
Member

/retest

@tekton-robot tekton-robot merged commit fcfe0d3 into tektoncd:main Jul 18, 2024
14 checks passed
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.

DryRun Validate should return the mutated Object
4 participants