diff --git a/pkg/apis/scheduling/types.go b/pkg/apis/scheduling/types.go index e09e12cc95..8437d97e76 100644 --- a/pkg/apis/scheduling/types.go +++ b/pkg/apis/scheduling/types.go @@ -34,6 +34,8 @@ const ( QueueStateClosed QueueState = "Closed" // QueueStateClosing indicate `Closing` state of queue QueueStateClosing QueueState = "Closing" + // QueueStateUnknown indicate `Unknown` state of queue + QueueStateUnknown QueueState = "Unknown" ) // These are the valid phase of podGroups. @@ -111,6 +113,28 @@ const ( NotEnoughPodsReason string = "NotEnoughTasks" ) +// QueueEvent represent the phase of queue +type QueueEvent string + +const ( + // QueueOutOfSyncEvent is triggered if PodGroup/Queue were updated + QueueOutOfSyncEvent QueueEvent = "OutOfSync" + // QueueCommandIssuedEvent is triggered if a command is raised by user + QueueCommandIssuedEvent QueueEvent = "CommandIssued" +) + +// QueueAction is the action that queue controller will take according to the event. +type QueueAction string + +const ( + // SyncQueueAction is the action to sync queue status. + SyncQueueAction QueueAction = "SyncQueue" + // OpenQueueAction is the action to open queue + OpenQueueAction QueueAction = "OpenQueue" + // CloseQueueAction is the action to close queue + CloseQueueAction QueueAction = "CloseQueue" +) + // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -252,3 +276,14 @@ type QueueList struct { // items is the list of PodGroup Items []Queue } + +// QueueRequest struct +type QueueRequest struct { + // Name is queue name + Name string + + // Event is event of queue + Event QueueEvent + // Action is action to be performed + Action QueueAction +} diff --git a/pkg/apis/scheduling/v1alpha2/types.go b/pkg/apis/scheduling/v1alpha2/types.go index a7d635448d..bff1da67cf 100644 --- a/pkg/apis/scheduling/v1alpha2/types.go +++ b/pkg/apis/scheduling/v1alpha2/types.go @@ -34,6 +34,8 @@ const ( QueueStateClosed QueueState = "Closed" // QueueStateClosing indicate `Closing` state of queue QueueStateClosing QueueState = "Closing" + // QueueStateUnknown indicate `Unknown` state of queue + QueueStateUnknown QueueState = "Unknown" ) // These are the valid phase of podGroups. @@ -111,6 +113,28 @@ const ( NotEnoughPodsReason string = "NotEnoughTasks" ) +// QueueEvent represent the phase of queue +type QueueEvent string + +const ( + // QueueOutOfSyncEvent is triggered if PodGroup/Queue were updated + QueueOutOfSyncEvent QueueEvent = "OutOfSync" + // QueueCommandIssuedEvent is triggered if a command is raised by user + QueueCommandIssuedEvent QueueEvent = "CommandIssued" +) + +// QueueAction is the action that queue controller will take according to the event. +type QueueAction string + +const ( + // SyncQueueAction is the action to sync queue status. + SyncQueueAction QueueAction = "SyncQueue" + // OpenQueueAction is the action to open queue + OpenQueueAction QueueAction = "OpenQueue" + // CloseQueueAction is the action to close queue + CloseQueueAction QueueAction = "CloseQueue" +) + // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -253,3 +277,14 @@ type QueueList struct { // items is the list of PodGroup Items []Queue `json:"items" protobuf:"bytes,2,rep,name=items"` } + +// QueueRequest struct +type QueueRequest struct { + // Name is queue name + Name string + + // Event is event of queue + Event QueueEvent + // Action is action to be performed + Action QueueAction +}