Skip to content

Commit 631d49e

Browse files
authored
add JobSuspended function for operators (#9)
1 parent b756bbb commit 631d49e

File tree

1 file changed

+14
-0
lines changed
  • pkg/apis/scheduling/v1alpha1

1 file changed

+14
-0
lines changed

pkg/apis/scheduling/v1alpha1/type.go

+14
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,19 @@ type QueueUnitList struct {
108108

109109
// Suspend is a flag that instructs the job operator to suspend processing this job
110110
const Suspend = "scheduling.x-k8s.io/suspend"
111+
111112
// Placement is the scheduling result of the scheduler
112113
const Placement = "scheduling.x-k8s.io/placement"
114+
115+
// JobSuspended checks if a Job should be suspended by checking whether its annotation contains key Suspend and its
116+
// value is set "true"
117+
func JobSuspended(job metav1.Object) bool {
118+
const suspended = "true"
119+
annotations := job.GetAnnotations()
120+
if annotations != nil {
121+
if val, exist := annotations[Suspend]; exist {
122+
return val == suspended
123+
}
124+
}
125+
return false
126+
}

0 commit comments

Comments
 (0)