Skip to content

Commit

Permalink
use wave.pusher.com/invalid to disable scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdoa2 committed May 2, 2024
1 parent eb3b6d4 commit 7f274b0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/daemonset/daemonset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ var _ = Describe("DaemonSet controller Suite", func() {

It("Has scheduling disabled", func() {
m.Get(daemonset, timeout).Should(Succeed())
Expect(daemonset.Spec.Template.Spec.SchedulerName).To(Equal("invalid"))
Expect(daemonset.Spec.Template.Spec.SchedulerName).To(Equal(core.SchedulingDisabledSchedulerName))
Expect(daemonset.ObjectMeta.Annotations[core.SchedulingDisabledAnnotation]).To(Equal("default-scheduler"))
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/deployment/deployment_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ var _ = Describe("Deployment controller Suite", func() {

It("Has scheduling disabled", func() {
m.Get(deployment, timeout).Should(Succeed())
Expect(deployment.Spec.Template.Spec.SchedulerName).To(Equal("invalid"))
Expect(deployment.Spec.Template.Spec.SchedulerName).To(Equal(core.SchedulingDisabledSchedulerName))
Expect(deployment.ObjectMeta.Annotations[core.SchedulingDisabledAnnotation]).To(Equal("default-scheduler"))
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/statefulset/statefulset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ var _ = Describe("StatefulSet controller Suite", func() {

It("Has scheduling disabled", func() {
m.Get(statefulset, timeout).Should(Succeed())
Expect(statefulset.Spec.Template.Spec.SchedulerName).To(Equal("invalid"))
Expect(statefulset.Spec.Template.Spec.SchedulerName).To(Equal(core.SchedulingDisabledSchedulerName))
Expect(statefulset.ObjectMeta.Annotations[core.SchedulingDisabledAnnotation]).To(Equal("default-scheduler"))
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/core/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func disableScheduling(obj podController) {

// Set invalid scheduler
podTemplate := obj.GetPodTemplate()
podTemplate.Spec.SchedulerName = "invalid"
podTemplate.Spec.SchedulerName = SchedulingDisabledSchedulerName
obj.SetPodTemplate(podTemplate)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/core/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var _ = Describe("Wave scheduler Suite", func() {

It("Disables scheduling", func() {
podTemplate := podControllerDeployment.GetPodTemplate()
Expect(podTemplate.Spec.SchedulerName).To(Equal("invalid"))
Expect(podTemplate.Spec.SchedulerName).To(Equal(SchedulingDisabledSchedulerName))
})

It("Is reports as disabled", func() {
Expand Down
3 changes: 3 additions & 0 deletions pkg/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const (
// due to missing children and contains the original scheduler
SchedulingDisabledAnnotation = "wave.pusher.com/scheduling-disabled"

// SchedulingDisabledSchedulerName is the dummy scheduler to disable scheduling of pods
SchedulingDisabledSchedulerName = "wave.pusher.com/invalid"

// RequiredAnnotation is the key of the annotation on the Deployment that Wave
// checks for before processing the deployment
RequiredAnnotation = "wave.pusher.com/update-on-config-change"
Expand Down

0 comments on commit 7f274b0

Please sign in to comment.