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

support running workloads in visibility endpoint #2145

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
190 changes: 188 additions & 2 deletions apis/visibility/v1alpha1/openapi/zz_generated.openapi.go

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

53 changes: 52 additions & 1 deletion apis/visibility/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import (
// +k8s:openapi-gen=true
// +genclient:nonNamespaced
// +genclient:method=GetPendingWorkloadsSummary,verb=get,subresource=pendingworkloads,result=sigs.k8s.io/kueue/apis/visibility/v1alpha1.PendingWorkloadsSummary
// +genclient:method=GetRunningWorkloadsSummary,verb=get,subresource=runningWorkloads,result=sigs.k8s.io/kueue/apis/visibility/v1alpha1.RunningWorkloadsSummary
type ClusterQueue struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Summary PendingWorkloadsSummary `json:"pendingWorkloadsSummary"`
PendingWorkloadsSummary PendingWorkloadsSummary `json:"pendingWorkloadsSummary"`
RunningWorkloadsSummary RunningWorkloadsSummary `json:"runningWorkloadsSummary"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -77,6 +79,37 @@ type PendingWorkload struct {
PositionInLocalQueue int32 `json:"positionInLocalQueue"`
}

// RunningWorkload is a user-facing representation of a running workload that summarizes the relevant information for
// assumed resources in the cluster queue.
type RunningWorkload struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// Priority indicates the workload's priority
Priority int32 `json:"priority"`
KunWuLuan marked this conversation as resolved.
Show resolved Hide resolved
// AdmissionTime indecates the time workloads admitted
AdmissionTime metav1.Time `json:"admissionTime"`
}

// +k8s:openapi-gen=true
// +kubebuilder:object:root=true

// RunningWorkloadsSummary contains a list of running workloads in the context
// of the query (within LocalQueue or ClusterQueue).
type RunningWorkloadsSummary struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Items []RunningWorkload `json:"items"`
}

// +kubebuilder:object:root=true
type RunningWorkloadsSummaryList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []RunningWorkloadsSummary `json:"items"`
}

// +k8s:openapi-gen=true
// +kubebuilder:object:root=true

Expand All @@ -102,6 +135,22 @@ type PendingWorkloadsSummaryList struct {
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:defaulter-gen=true

// RunningWorkloadOptions are query params used in the visibility queries
type RunningWorkloadOptions struct {
metav1.TypeMeta `json:",inline"`

// Offset indicates position of the first pending workload that should be fetched, starting from 0. 0 by default
Offset int64 `json:"offset"`

// Limit indicates max number of pending workloads that should be fetched. 1000 by default
Limit int64 `json:"limit,omitempty"`
}

// +kubebuilder:object:root=true
// +k8s:openapi-gen=true
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:defaulter-gen=true

// PendingWorkloadOptions are query params used in the visibility queries
type PendingWorkloadOptions struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -117,5 +166,7 @@ func init() {
SchemeBuilder.Register(
&PendingWorkloadsSummary{},
&PendingWorkloadOptions{},
&RunningWorkloadsSummary{},
&RunningWorkloadOptions{},
)
}
30 changes: 30 additions & 0 deletions apis/visibility/v1alpha1/zz_generated.conversion.go

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

Loading