Skip to content

Commit

Permalink
Expose available ResourceFlavors from the ClusterQueue in the LocalQu…
Browse files Browse the repository at this point in the history
…eue status. (kubernetes-sigs#3143)

* Expose Flavors in LocalQueue Status.

* Initialize flavors after check that feature enabled.

* Sort flavors list.

* Propagate gomega to eventually.

* Get sorted list on Resources slice.

* Sort flavor list by flavor order.
  • Loading branch information
mbobrovskyi authored and kannon92 committed Nov 19, 2024
1 parent c90d2ce commit f419ed1
Show file tree
Hide file tree
Showing 14 changed files with 861 additions and 156 deletions.
34 changes: 34 additions & 0 deletions apis/kueue/v1beta1/localqueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,33 @@ type LocalQueueSpec struct {
// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
type ClusterQueueReference string

type LocalQueueFlavorStatus struct {
// name of the flavor.
// +required
// +kubebuilder:validation:Required
Name ResourceFlavorReference `json:"name"`

// resources used in the flavor.
// +listType=set
// +kubebuilder:validation:MaxItems=16
// +optional
Resources []corev1.ResourceName `json:"resources,omitempty"`

// nodeLabels are labels that associate the ResourceFlavor with Nodes that
// have the same labels.
// +mapType=atomic
// +kubebuilder:validation:MaxProperties=8
// +optional
NodeLabels map[string]string `json:"nodeLabels,omitempty"`

// nodeTaints are taints that the nodes associated with this ResourceFlavor
// have.
// +listType=atomic
// +kubebuilder:validation:MaxItems=8
// +optional
NodeTaints []corev1.Taint `json:"nodeTaints,omitempty"`
}

// LocalQueueStatus defines the observed state of LocalQueue
type LocalQueueStatus struct {
// PendingWorkloads is the number of Workloads in the LocalQueue not yet admitted to a ClusterQueue
Expand Down Expand Up @@ -88,6 +115,13 @@ type LocalQueueStatus struct {
// +kubebuilder:validation:MaxItems=16
// +optional
FlavorUsage []LocalQueueFlavorUsage `json:"flavorUsage"`

// flavors lists all currently available ResourceFlavors in specified ClusterQueue.
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=16
// +optional
Flavors []LocalQueueFlavorStatus `json:"flavors,omitempty"`
}

const (
Expand Down
41 changes: 41 additions & 0 deletions apis/kueue/v1beta1/zz_generated.deepcopy.go

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

72 changes: 72 additions & 0 deletions charts/kueue/templates/crd/kueue.x-k8s.io_localqueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,78 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
flavors:
description: flavors lists all currently available ResourceFlavors
in specified ClusterQueue.
items:
properties:
name:
description: name of the flavor.
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
nodeLabels:
additionalProperties:
type: string
description: |-
nodeLabels are labels that associate the ResourceFlavor with Nodes that
have the same labels.
maxProperties: 8
type: object
x-kubernetes-map-type: atomic
nodeTaints:
description: |-
nodeTaints are taints that the nodes associated with this ResourceFlavor
have.
items:
description: |-
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.
properties:
effect:
description: |-
Required. The effect of the taint on pods
that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: Required. The taint key to be applied to
a node.
type: string
timeAdded:
description: |-
TimeAdded represents the time at which the taint was added.
It is only written for NoExecute taints.
format: date-time
type: string
value:
description: The taint value corresponding to the taint
key.
type: string
required:
- effect
- key
type: object
maxItems: 8
type: array
x-kubernetes-list-type: atomic
resources:
description: resources used in the flavor.
items:
description: ResourceName is the name identifying various
resources in a ResourceList.
type: string
maxItems: 16
type: array
x-kubernetes-list-type: set
required:
- name
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
flavorsReservation:
description: |-
flavorsReservation are the reserved quotas, by flavor currently in use by the
Expand Down

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

26 changes: 20 additions & 6 deletions client-go/applyconfiguration/kueue/v1beta1/localqueuestatus.go

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

2 changes: 2 additions & 0 deletions client-go/applyconfiguration/utils.go

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

72 changes: 72 additions & 0 deletions config/components/crd/bases/kueue.x-k8s.io_localqueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,78 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
flavors:
description: flavors lists all currently available ResourceFlavors
in specified ClusterQueue.
items:
properties:
name:
description: name of the flavor.
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
nodeLabels:
additionalProperties:
type: string
description: |-
nodeLabels are labels that associate the ResourceFlavor with Nodes that
have the same labels.
maxProperties: 8
type: object
x-kubernetes-map-type: atomic
nodeTaints:
description: |-
nodeTaints are taints that the nodes associated with this ResourceFlavor
have.
items:
description: |-
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.
properties:
effect:
description: |-
Required. The effect of the taint on pods
that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: Required. The taint key to be applied to
a node.
type: string
timeAdded:
description: |-
TimeAdded represents the time at which the taint was added.
It is only written for NoExecute taints.
format: date-time
type: string
value:
description: The taint value corresponding to the taint
key.
type: string
required:
- effect
- key
type: object
maxItems: 8
type: array
x-kubernetes-list-type: atomic
resources:
description: resources used in the flavor.
items:
description: ResourceName is the name identifying various
resources in a ResourceList.
type: string
maxItems: 16
type: array
x-kubernetes-list-type: set
required:
- name
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
flavorsReservation:
description: |-
flavorsReservation are the reserved quotas, by flavor currently in use by the
Expand Down
Loading

0 comments on commit f419ed1

Please sign in to comment.