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 CEL rules to ClusterQueue #1972

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update message for validation rule
  • Loading branch information
IrvingMg committed Apr 12, 2024
commit b0dc005f87485d02ae611c8a6f298eeabc7781d6
2 changes: 1 addition & 1 deletion apis/kueue/v1beta1/clusterqueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

// ClusterQueueSpec defines the desired state of ClusterQueue
// +kubebuilder:validation:XValidation:rule="(!has(self.cohort) || size(self.cohort) == 0) && has(self.resourceGroups) ? self.resourceGroups.all(rg, rg.flavors.all(f, f.resources.all(r, !has(r.borrowingLimit)))) : true", message="resourceGroups[0].flavors[0].resources[0].borrowingLimit must be nil when cohort is empty"
// +kubebuilder:validation:XValidation:rule="(!has(self.cohort) || size(self.cohort) == 0) && has(self.resourceGroups) ? self.resourceGroups.all(rg, rg.flavors.all(f, f.resources.all(r, !has(r.borrowingLimit)))) : true", message="borrowingLimit must be nil when cohort is empty"
IrvingMg marked this conversation as resolved.
Show resolved Hide resolved
type ClusterQueueSpec struct {
// resourceGroups describes groups of resources.
// Each resource group defines the list of resources and a list of flavors
Expand Down
6 changes: 4 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 @@ -103,6 +103,7 @@ spec:
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
flavorFungibility:
default: {}
description: |-
flavorFungibility defines whether a workload should try the next flavor
before borrowing or preempting in the flavor being evaluated.
Expand Down Expand Up @@ -187,6 +188,7 @@ spec:
type: object
x-kubernetes-map-type: atomic
preemption:
default: {}
description: |-
preemption describes policies to preempt Workloads from this ClusterQueue
or the ClusterQueue's cohort.
Expand All @@ -208,6 +210,7 @@ spec:
lower priority first.
properties:
borrowWithinCohort:
default: {}
description: |-
borrowWithinCohort provides configuration to allow preemption within
cohort while borrowing.
Expand Down Expand Up @@ -453,8 +456,7 @@ spec:
type: string
type: object
x-kubernetes-validations:
- message: resourceGroups[0].flavors[0].resources[0].borrowingLimit must
be nil when cohort is empty
- message: borrowingLimit must be nil when cohort is empty
rule: '(!has(self.cohort) || size(self.cohort) == 0) && has(self.resourceGroups)
? self.resourceGroups.all(rg, rg.flavors.all(f, f.resources.all(r,
!has(r.borrowingLimit)))) : true'
Expand Down