-
Notifications
You must be signed in to change notification settings - Fork 299
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 FairSharing config to Cohort #4288
Add FairSharing config to Cohort #4288
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
6fc9f4e
to
23da91e
Compare
pkg/util/testing/wrappers.go
Outdated
if c.Spec.FairSharing == nil { | ||
c.Spec.FairSharing = &kueue.FairSharing{} | ||
} | ||
c.Spec.FairSharing.Weight = ptr.To(w) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.Spec.FairSharing.Weight = ptr.To(w) | |
c.Spec.FairSharing.Weight = &w |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, also for ClusterQueue.
/lgtm |
LGTM label has been added. Git tree hash: 973952d7333724994df200d98cb0b3c3012bd58c
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, mostly lgtm
apis/kueue/v1beta1/fair_sharing.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this to fairsharing.go
? Acutally, we use localqueue_type.go
not local_queue_type.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe even better to fairsharing_types.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
apis/kueue/v1alpha1/cohort_types.go
Outdated
@@ -60,6 +60,11 @@ type CohortSpec struct { | |||
//+listType=atomic | |||
//+kubebuilder:validation:MaxItems=16 | |||
ResourceGroups []kueuebeta.ResourceGroup `json:"resourceGroups,omitempty"` | |||
|
|||
// fairSharing defines the properties of the Cohort when | |||
// participating in FairSharing. The values are only relevant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// participating in FairSharing. The values are only relevant | |
// participating in FairSharing. The values are only relevant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
apis/kueue/v1alpha1/cohort_types.go
Outdated
// fairSharing defines the properties of the Cohort when | ||
// participating in FairSharing. The values are only relevant | ||
// if FairSharing is enabled in the Kueue configuration. | ||
FairSharing *kueuebeta.FairSharing `json:"fairSharing,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE
This matches to design proposal:
kueue/keps/1714-fair-sharing/README.md
Lines 222 to 228 in 06d4c76
Weights will be added to ClusterQueueSpec and CohortSpec in the following optional struct: | |
```go | |
type struct FairSharing { | |
Weight *Quantity // Default is 1. | |
} | |
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can move almost cases to UTs to check fingrained rejected reason and improve tests duration.
For integration tests, we can just have one valid and one invalid case each for CRUD operation.
But that is out of the scope of this PR.
Would you mind working on that in a follow-up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember thinking about this when implementing Cohort webhook - the issue is that we are doing some validation using kubebuilder, which I don't think we can exercise during unit tests. Also in ClusterQueue; e.g.
// +kubebuilder:validation:XValidation:rule="!has(self.cohort) && 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the CEL should be verified in integration testing. But for webhook cases, we can move those to UTs.
That would be useful to reduce long-running CI and testing.
23da91e
to
4b2237c
Compare
/lgtm |
LGTM label has been added. Git tree hash: c69d8cc6c1fa877dab7109978cc3177e201099db
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit
// fairSharing defines the properties of the Cohort when | ||
// participating in FairSharing. The values are only relevant | ||
// if FairSharing is enabled in the Kueue configuration. | ||
FairSharing *kueuebeta.FairSharing `json:"fairSharing,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FairSharing *kueuebeta.FairSharing `json:"fairSharing,omitempty"` | |
// +optional | |
FairSharing *kueuebeta.FairSharing `json:"fairSharing,omitempty"` |
Indeed, we forget to add +optional
marker when we introduce fairSharing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
// fairSharing defines the properties of the ClusterQueue when participating in fair sharing. | ||
// The values are only relevant if fair sharing is enabled in the Kueue configuration. | ||
// fairSharing defines the properties of the ClusterQueue when | ||
// participating in FairSharing. The values are only relevant | ||
// if FairSharing is enabled in the Kueue configuration. | ||
FairSharing *FairSharing `json:"fairSharing,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you address +optional
marker for CQ in a follow-up PR, and then cherry-pick that to release branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create pull request once this PR merges, so that I do not need to resolve conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/lgtm
/approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4b2237c
to
6c74150
Compare
LGTM label has been added. Git tree hash: 39af0a096975888e4db470d4f577be12b9b61709
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabesaba, tenzen-y The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add FairSharing to Cohort API. Update shared structure and respective documentation documentation which are used now by both Cohort and ClusterQueue.
Updating cache and scheduling logic to use this change will be done in subsequent PRs, to keep PR size managable.
Which issue(s) this PR fixes:
Part of #3759
Special notes for your reviewer:
No release note for this change, as we will do a single release note for the entire feature.
Does this PR introduce a user-facing change?