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

Introduce AdmissionCheckStrategy API, change assigning AdmissionCheck… #1960

Merged
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
25 changes: 24 additions & 1 deletion apis/kueue/v1beta1/clusterqueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ type ClusterQueueSpec struct {
// +kubebuilder:default={}
Preemption *ClusterQueuePreemption `json:"preemption,omitempty"`

// admissionChecks lists the AdmissionChecks required by this ClusterQueue
// admissionChecks lists the AdmissionChecks required by this ClusterQueue.
// Cannot be used along with AdmissionCheckStrategy.
// +optional
AdmissionChecks []string `json:"admissionChecks,omitempty"`
PBundyra marked this conversation as resolved.
Show resolved Hide resolved

// admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks.
// This property cannot be used in conjunction with the 'admissionChecks' property.
// +optional
AdmissionChecksStrategy AdmissionChecksStrategy `json:"admissionChecksStrategy,omitempty"`
PBundyra marked this conversation as resolved.
Show resolved Hide resolved

// stopPolicy - if set to a value different from None, the ClusterQueue is considered Inactive, no new reservation being
// made.
//
Expand All @@ -117,6 +123,23 @@ type ClusterQueueSpec struct {
StopPolicy *StopPolicy `json:"stopPolicy,omitempty"`
}

// AdmissionCheckStrategy defines a strategy for a AdmissionCheck.
type AdmissionChecksStrategy struct {
// admissionChecks is a list of strategies for AdmissionChecks
AdmissionChecks []AdmissionCheckStrategyRule `json:"admissionChecks,omitempty"`
}

// AdmissionCheckStrategyRule defines rules for a single AdmissionCheck
type AdmissionCheckStrategyRule struct {
// name is an AdmissionCheck's name.
Name string `json:"name"`

// onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for.
// If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue.
// +optional
OnFlavors []ResourceFlavorReference `json:"onFlavors"`
PBundyra marked this conversation as resolved.
Show resolved Hide resolved
}

type QueueingStrategy string

const (
Expand Down
43 changes: 43 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.

35 changes: 33 additions & 2 deletions charts/kueue/templates/crd/kueue.x-k8s.io_clusterqueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,42 @@ spec:
description: ClusterQueueSpec defines the desired state of ClusterQueue
properties:
admissionChecks:
description: admissionChecks lists the AdmissionChecks required by
this ClusterQueue
description: |-
admissionChecks lists the AdmissionChecks required by this ClusterQueue.
Cannot be used along with AdmissionCheckStrategy.
items:
type: string
type: array
admissionChecksStrategy:
description: |-
admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks.
This property cannot be used in conjunction with the 'admissionChecks' property.
properties:
admissionChecks:
description: admissionChecks is a list of strategies for AdmissionChecks
items:
description: AdmissionCheckStrategyRule defines rules for a
single AdmissionCheck
properties:
name:
description: name is an AdmissionCheck's name.
type: string
onFlavors:
description: |-
onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for.
If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue.
items:
description: ResourceFlavorReference is the name of the
ResourceFlavor.
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: array
required:
- name
type: object
type: array
type: object
cohort:
description: |-
cohort that this ClusterQueue belongs to. CQs that belong to the
Expand Down

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

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

25 changes: 17 additions & 8 deletions client-go/applyconfiguration/kueue/v1beta1/clusterqueuespec.go

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

4 changes: 4 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.

35 changes: 33 additions & 2 deletions config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,42 @@ spec:
description: ClusterQueueSpec defines the desired state of ClusterQueue
properties:
admissionChecks:
description: admissionChecks lists the AdmissionChecks required by
this ClusterQueue
description: |-
admissionChecks lists the AdmissionChecks required by this ClusterQueue.
Cannot be used along with AdmissionCheckStrategy.
items:
type: string
type: array
admissionChecksStrategy:
description: |-
admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks.
This property cannot be used in conjunction with the 'admissionChecks' property.
properties:
admissionChecks:
description: admissionChecks is a list of strategies for AdmissionChecks
items:
description: AdmissionCheckStrategyRule defines rules for a
single AdmissionCheck
properties:
name:
description: name is an AdmissionCheck's name.
type: string
onFlavors:
description: |-
onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for.
If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue.
items:
description: ResourceFlavorReference is the name of the
ResourceFlavor.
maxLength: 253
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: array
required:
- name
type: object
type: array
type: object
cohort:
description: |-
cohort that this ClusterQueue belongs to. CQs that belong to the
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func (c *Cache) ClusterQueuesUsingAdmissionCheck(ac string) []string {
var cqs []string

for _, cq := range c.clusterQueues {
if cq.AdmissionChecks.Has(ac) {
if _, found := cq.AdmissionChecks[ac]; found {
cqs = append(cqs, cq.Name)
}
}
Expand Down
Loading