Skip to content
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 state parameter to queueSpec and queueStatus for queue #508

Merged
merged 2 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ spec:
weight:
format: int32
type: integer
state:
type: string
type: object
status:
properties:
state:
type: string
unknown:
format: int32
type: integer
Expand All @@ -37,6 +41,9 @@ spec:
running:
format: int32
type: integer
inqueue:
format: int32
type: integer
type: object
type: object
version: v1alpha2
Expand Down
7 changes: 7 additions & 0 deletions installer/volcano-development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -782,9 +782,13 @@ spec:
weight:
format: int32
type: integer
state:
type: string
type: object
status:
properties:
state:
type: string
unknown:
format: int32
type: integer
Expand All @@ -794,6 +798,9 @@ spec:
running:
format: int32
type: integer
inqueue:
format: int32
type: integer
type: object
type: object
version: v1alpha2
Expand Down
16 changes: 16 additions & 0 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ import (
// PodGroupPhase is the phase of a pod group at the current time.
type PodGroupPhase string

// QueueState is state type of queue
type QueueState string

const (
// QueueStateOpen indicate `Open` state of queue
QueueStateOpen QueueState = "Open"
// QueueStateClosed indicate `Closed` state of queue
QueueStateClosed QueueState = "Closed"
// QueueStateClosing indicate `Closing` state of queue
QueueStateClosing QueueState = "Closing"
)

// These are the valid phase of podGroups.
const (
// PodPending means the pod group has been accepted by the system, but scheduler can not allocate
Expand Down Expand Up @@ -202,12 +214,16 @@ type QueueStatus struct {
Running int32
// The number of `Inqueue` PodGroup in this queue.
Inqueue int32
// State is status of queue
State QueueState
}

// QueueSpec represents the template of Queue.
type QueueSpec struct {
Weight int32
Capability v1.ResourceList
// State controller the status of queue
State QueueState
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/scheduling/v1alpha1/conversion.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package v1alpha1

import (
"unsafe"

v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"

"volcano.sh/volcano/pkg/apis/scheduling"
)

Expand All @@ -17,6 +21,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
// functions are the same as the autogenerated ones in every other way.
err := scheme.AddConversionFuncs(
Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus,
Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec,
)
if err != nil {
return err
Expand All @@ -31,3 +36,9 @@ func Convert_scheduling_QueueStatus_To_v1alpha1_QueueStatus(in *scheduling.Queue
out.Running = in.Running
return nil
}

func Convert_scheduling_QueueSpec_To_v1alpha1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error {
out.Weight = in.Weight
out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability))
return nil
}
12 changes: 7 additions & 5 deletions pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pkg/apis/scheduling/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ import (
// PodGroupPhase is the phase of a pod group at the current time.
type PodGroupPhase string

// QueueState is state type of queue
type QueueState string

const (
// QueueStateOpen indicate `Open` state of queue
QueueStateOpen QueueState = "Open"
// QueueStateClosed indicate `Closed` state of queue
QueueStateClosed QueueState = "Closed"
// QueueStateClosing indicate `Closing` state of queue
QueueStateClosing QueueState = "Closing"
)

// These are the valid phase of podGroups.
const (
// PodPending means the pod group has been accepted by the system, but scheduler can not allocate
Expand Down Expand Up @@ -203,12 +215,16 @@ type QueueStatus struct {
Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"`
// The number of `Inqueue` PodGroup in this queue.
Inqueue int32 `json:"inqueue,omitempty" protobuf:"bytes,4,opt,name=inqueue"`
// State is state of queue
State QueueState `json:"state,omitempty" protobuf:"bytes,5,opt,name=state"`
}

// QueueSpec represents the template of Queue.
type QueueSpec struct {
Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"`
Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"`
// State controller the status of queue
State QueueState `json:"state,omitempty" protobuf:"bytes,3,opt,name=state"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.