Skip to content

Commit

Permalink
feat(apis): add completed state to podgroup&queue
Browse files Browse the repository at this point in the history
Signed-off-by: shinytang6 <1074461480@qq.com>
  • Loading branch information
shinytang6 committed Mar 26, 2022
1 parent 169d1aa commit c92b255
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hack/generate-groups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ APIS_PKG="$3"
GROUPS_WITH_VERSIONS="$4"
shift 4

go get k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}@v0.23.0
go install k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}@v0.23.0

# Go installs the above commands to get installed in $GOBIN if defined, and $GOPATH/bin otherwise:
GOBIN="$(go env GOBIN)"
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-internal-groups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ EXT_APIS_PKG="$4"
GROUPS_WITH_VERSIONS="$5"
shift 5

go get k8s.io/code-generator/cmd/{defaulter-gen,conversion-gen,client-gen,lister-gen,informer-gen,deepcopy-gen,openapi-gen}@v0.23.0
go install k8s.io/code-generator/cmd/{defaulter-gen,conversion-gen,client-gen,lister-gen,informer-gen,deepcopy-gen,openapi-gen}@v0.23.0

# Go installs the above commands to get installed in $GOBIN if defined, and $GOPATH/bin otherwise:
GOBIN="$(go env GOBIN)"
Expand Down
9 changes: 7 additions & 2 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ const (

// These are the valid phase of podGroups.
const (
// PodPending means the pod group has been accepted by the system, but scheduler can not allocate
// PodGroupPending means the pod group has been accepted by the system, but scheduler can not allocate
// enough resources to it.
PodGroupPending PodGroupPhase = "Pending"

// PodRunning means `spec.minMember` pods of PodGroups has been in running phase.
// PodGroupRunning means `spec.minMember` pods of PodGroup has been in running phase.
PodGroupRunning PodGroupPhase = "Running"

// PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not
Expand All @@ -51,6 +51,9 @@ const (
// PodGroupInqueue means controllers can start to create pods,
// is a new state between PodGroupPending and PodGroupRunning
PodGroupInqueue PodGroupPhase = "Inqueue"

// PodGroupCompleted means all the pods of PodGroup are completed
PodGroupCompleted PodGroupPhase = "Completed"
)

type PodGroupConditionType string
Expand Down Expand Up @@ -273,6 +276,8 @@ type QueueStatus struct {
Running int32
// The number of `Inqueue` PodGroup in this queue.
Inqueue int32
// The number of `Completed` PodGroup in this queue.
Completed int32

// Reservation is the profile of resource reservation for queue
Reservation Reservation `json:"reservation,omitempty" protobuf:"bytes,6,opt,name=reservation"`
Expand Down
9 changes: 7 additions & 2 deletions pkg/apis/scheduling/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const (

// These are the valid phase of podGroups.
const (
// PodPending means the pod group has been accepted by the system, but scheduler can not allocate
// PodGroupPending means the pod group has been accepted by the system, but scheduler can not allocate
// enough resources to it.
PodGroupPending PodGroupPhase = "Pending"

// PodRunning means `spec.minMember` pods of PodGroups has been in running phase.
// PodGroupRunning means `spec.minMember` pods of PodGroup has been in running phase.
PodGroupRunning PodGroupPhase = "Running"

// PodGroupUnknown means part of `spec.minMember` pods are running but the other part can not
Expand All @@ -54,6 +54,9 @@ const (
// PodGroupInqueue means controllers can start to create pods,
// is a new state between PodGroupPending and PodGroupRunning
PodGroupInqueue PodGroupPhase = "Inqueue"

// PodGroupCompleted means all the pods of PodGroup are completed
PodGroupCompleted PodGroupPhase = "Completed"
)

type PodGroupConditionType string
Expand Down Expand Up @@ -289,6 +292,8 @@ type QueueStatus struct {
Running int32 `json:"running,omitempty" protobuf:"bytes,4,opt,name=running"`
// The number of `Inqueue` PodGroup in this queue.
Inqueue int32 `json:"inqueue,omitempty" protobuf:"bytes,5,opt,name=inqueue"`
// The number of `Completed` PodGroup in this queue.
Completed int32 `json:"completed,omitempty" protobuf:"bytes,5,opt,name=completed"`

// Reservation is the profile of resource reservation for queue
Reservation Reservation `json:"reservation,omitempty" protobuf:"bytes,6,opt,name=reservation"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/scheduling/v1beta1/zz_generated.conversion.go

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

0 comments on commit c92b255

Please sign in to comment.