-
Notifications
You must be signed in to change notification settings - Fork 112
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
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
872db31
to
462d9bb
Compare
4ecfc21
to
dfe25d5
Compare
e449fbd
to
03b3b21
Compare
3e66b55
to
43382a6
Compare
/kind feature |
Ok, this is ready for review/discussion. I was unsure how the implementation should look for the strategic merge json patch mentioned in https://github.com/shipwright-io/community/blob/main/ships/0039-build-scheduler-opts.md#tolerations This currently works and patches the BuildRun/Build object:
But didn't know if that was all that was required or what that should ideally look like. Also looking for input on what implementing the subset of tolerations functionality should ideally look like, or if the current implementation is ok (failing validation if unsupported fields are specified/ always setting "NoSchedule"). I've also left the validaitons on the Shipwright end to enforce the simpler requirements here, and let Kubernetes do the rest of the toleration validation with the full ruleset. |
43382a6
to
c35d173
Compare
8aa27d4
to
5dbdbba
Compare
Signed-off-by: Dylan Orzel <[email protected]>
Signed-off-by: Dylan Orzel <[email protected]>
Signed-off-by: Dylan Orzel <[email protected]>
5dbdbba
to
30677bc
Compare
Bit stumped on the failing integration tests - after several revisions I can't find why the taint effect isn't getting set. It also looks like the e2e tests are running out of disk space. |
if toleration.Effect != v1.TaintEffectNoSchedule { | ||
if !(len(toleration.Effect) > 0) { | ||
// Effect was not specified, set it to the supported default | ||
b.Build.Spec.Tolerations[i].Effect = v1.TaintEffectNoSchedule | ||
} else { | ||
b.Build.Status.Reason = ptr.To(build.TolerationNotValid) | ||
b.Build.Status.Message = ptr.To(fmt.Sprintf("Only the '%v' toleration effect is supported.", v1.TaintEffectNoSchedule)) | ||
} | ||
} |
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.
Trying to remove nested if
s.
if toleration.Effect != v1.TaintEffectNoSchedule { | |
if !(len(toleration.Effect) > 0) { | |
// Effect was not specified, set it to the supported default | |
b.Build.Spec.Tolerations[i].Effect = v1.TaintEffectNoSchedule | |
} else { | |
b.Build.Status.Reason = ptr.To(build.TolerationNotValid) | |
b.Build.Status.Message = ptr.To(fmt.Sprintf("Only the '%v' toleration effect is supported.", v1.TaintEffectNoSchedule)) | |
} | |
} | |
switch (toleration.Effect) { | |
case "": | |
// Effect was not specified, set it to the supported default | |
b.Build.Spec.Tolerations[i].Effect = v1.TaintEffectNoSchedule | |
case v1.TaintEffectNoSchedule: | |
// Allowed value | |
default: | |
b.Build.Status.Reason = ptr.To(build.TolerationNotValid) | |
b.Build.Status.Message = ptr.To(fmt.Sprintf("Only the '%v' toleration effect is supported.", v1.TaintEffectNoSchedule)) | |
} |
@@ -706,4 +708,54 @@ var _ = Describe("For a Kubernetes cluster with Tekton and build installed", fun | |||
}) | |||
}) | |||
|
|||
Context("when tolerations are specified", func() { |
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.
Because of node taints
Context("when tolerations are specified", func() { | |
Context("when tolerations are specified", Serial, func() { |
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