-
Notifications
You must be signed in to change notification settings - Fork 113
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 Tolerations to Build and BuildRun objects #1711
base: main
Are you sure you want to change the base?
Conversation
872db31
to
462d9bb
Compare
4ecfc21
to
dfe25d5
Compare
e449fbd
to
03b3b21
Compare
3e66b55
to
43382a6
Compare
An update - still looking into why TaintEffect isn't getting set in the integration tests. Integration tests are at least all failing in the same way. |
f17465b
to
5181b3f
Compare
Would I be able to get another look at this? I'm having an issue with the validation logic for the taint effect: In the case where the effect isn't specified in the yaml, as in this test: It should get explicitly set on the TaskRun object via the validation logic, but that doesn't happen. Confused, as everything else for the validation seems to work. |
Sry for the late reply @dorzel. The validation logic should imo NOT mutate anything on the object. It should only validate. If empty is a good value for the effect, then that's all the validation should do: not complain anything. The logic that creates the toleration on the TaskRun should then again be aware that empty is a valid value for the effect and translate that into TaintEffectNoSchedule. |
5181b3f
to
0ecf83f
Compare
Ok, reverted to setting the TaintEffect outside of validation and that has fixed the integration tests (one unrelated flaky test). Looks like we're just waiting on #1786 to get an actual signal from e2e tests. |
090570c
to
b8e487a
Compare
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.
Nice that tests now succeed. I still have one more homework for you. Sorry that I missed that earlier.
// In this case, fields set only on the BuildRun object do not get validated as they are not copied to the transient Build resource. | ||
// explicitly setting them here is required for validation to happen. | ||
build.Spec.NodeSelector = buildRun.Spec.NodeSelector | ||
build.Spec.Tolerations = buildRun.Spec.Tolerations |
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.
This is not correct and reminds me of something that I missed earlier (also for nodeSelector). Users can define these things both in the inline build spec as well as the overrides on the buildrun spec.
Two things:
- We should validate the buildrun spec fields somewhere near here (https://github.com/shipwright-io/build/blob/v0.14.0/pkg/reconciler/buildrun/buildrun.go#L276-L292) and not copy it over to a build spec to perform a validation.
- When an inline build spec is used, we validate that certain fields are not set on the buildrun spec because it does not make sense to have them specified in two places. That would be suitable for both nodeSelector and tolerations as well. The code that validates this is here: https://github.com/shipwright-io/build/blob/v0.14.0/pkg/validate/validate.go#L106-L136. Basically, when somebody creates a standalone BuildRun (= with an inline Build spec), we expect that BuildRun to not also set those fields (params, volumes, timeout etc) on the BuildRun spec itself.
Can you adopt this please.
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.
Ah, so if I understand it seems that specifically in the inline build spec case we expect that certain fields are only specified on that build spec instead of having, for example, the "BuildRun Tolerations take preference over Build Tolerations" behavior (overriding). I'll implement these.
Signed-off-by: Dylan Orzel <dorzel@redhat.com>
fa80d86
to
b0fee7d
Compare
Signed-off-by: Dylan Orzel <dorzel@redhat.com>
Signed-off-by: Dylan Orzel <dorzel@redhat.com>
b0fee7d
to
e889d0a
Compare
Changes
Fixes #1636
Submitter Checklist
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes