-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add taskSpec resources validation #4547
Add taskSpec resources validation #4547
Conversation
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
@@ -142,3 +142,18 @@ func ValidateResolvedTaskResources(ctx context.Context, params []v1beta1.Param, | |||
|
|||
return nil | |||
} | |||
|
|||
func ValidateTaskSpecRequestResources(ctx context.Context, taskSpec *v1beta1.TaskSpec) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method only exported so that it can be tested from package taskrun_test
?
If so, this is generally not a best practice. It both means the method will be unnecessarily exported to external users, who may depend on its behavior not changing. The reason the test is in package taskrun_test
is to be able to test only exported behaviors, so perhaps we should change it to package taskrun
and test unexported methods/behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is exported to be used in taskrun.go -> prepare()
, similar like ValidateResolvedTaskResources
. I forgot to add comment before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, I will make it unexported
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
f90119b
to
b271af6
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-alpha-integration-tests |
76f607f
to
a3c66dd
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-integration-tests |
/cc @wlynch |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: imjasonh 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this act with LimitRange ? aka is the validation done pre or post applying limit range ? (I think it's pre). This means it only validates the users request – aka if there is LimitRange, then it would pass the validation but could fail later (LimitRange being mis-configured). I think that's fine, but I just want to make sure it is.
This is a good question. And I agree that if LimitRange is mis-configured it will pass this and fail somewhere else. Validating |
Sounds good @Yongxuanzhang 🎉 |
Changes
This PR introduces the taskSpec resources validation, and mark the taskrun failed reason to
ReasonFailedValidation
. Before this commit the reason will be recognized asCouldntGetTask
.FIxes: #4512
/kind bug
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes