-
Notifications
You must be signed in to change notification settings - Fork 288
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
Dynamically reclaiming resources #756
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
/cc @alculquicondor |
test/integration/controller/core/clusterqueue_controller_test.go
Outdated
Show resolved
Hide resolved
de1ca9e
to
5f30896
Compare
// +optional | ||
// +listType=map | ||
// +listMapKey=name | ||
ReclaimablePods []ReclaimablePod `json:"reclaimablePods,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.
I'm having second thoughts here.
If we assume that the admission section can be modified after admission (to update Count and usage), then I prefer we have reclaimableCount
inside the admission struct.
I think this might be a better idea as we move towards elastic jobs. @tenzen-y ?
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.
then I prefer we have reclaimableCount inside the admission struct.
Does this mean we have reclaimableCount
inside the admission instead of having this ReclaimablePods
(removing ReclaimablePods
)?
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.
yes, that's what I'm thinking.
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.
IIRC, we selected ReclaimablePods
instead of reclaimableCount
since it could be misleading when the job is suspended.
However, as @alculquicondor says, we can ignore that concern if we have reclaimableCount
inside the Admission
.
I think this might be a better idea as we move towards elastic jobs.
right. The Admission
has the reclaimableCount
would be more natural for the elastic job.
@trasc Are you concerned about having reclaimableCount
inside the Admission
?
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.
If we assume that the admission section can be modified after admission (to update Count and usage), then I prefer we have
reclaimableCount
inside the admission struct.
The admission is not changed when reclaimable changes.
@trasc Are you concerned about having reclaimableCount inside the Admission?
SSA conflicts. We should keep them separated.
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.
Let's say we have elastic jobs. Then the kueue scheduler+preemption could update count
.
However, this is generally independent from the concept of reclaiming pods.
Ok, let's keep it like this.
Any reason why not make this map[string]int32
?
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.
just to look similar to flavors and usage
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.
A few nits
// +optional | ||
// +listType=map | ||
// +listMapKey=name | ||
ReclaimablePods []ReclaimablePod `json:"reclaimablePods,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.
Let's say we have elastic jobs. Then the kueue scheduler+preemption could update count
.
However, this is generally independent from the concept of reclaiming pods.
Ok, let's keep it like this.
Any reason why not make this map[string]int32
?
@@ -288,3 +341,30 @@ func GetQueueOrderTimestamp(w *kueue.Workload) *metav1.Time { | |||
func IsAdmitted(w *kueue.Workload) bool { | |||
return apimeta.IsStatusConditionTrue(w.Status.Conditions, kueue.WorkloadAdmitted) | |||
} | |||
|
|||
// UpdateReclaimablePods updates the ReclaimablePods list for the workload wit SSA. | |||
func UpdateReclaimablePods(ctx context.Context, c client.Client, w *kueue.Workload, reclaimablePods []kueue.ReclaimablePod) error { |
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.
func UpdateReclaimablePods(ctx context.Context, c client.Client, w *kueue.Workload, reclaimablePods []kueue.ReclaimablePod) error { | |
func ApplyReclaimablePods(ctx context.Context, c client.Client, w *kueue.Workload, reclaimablePods []kueue.ReclaimablePod) error { |
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.
Let's keep "Apply" , for when we only push parts of a workload to the api server.
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.
Which this does?
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.
reclaimablePods []kueue.ReclaimablePod
is not part of the workload now, w *kueue.Workload
is used to identify the target.
vs func ApplyAdmissionStatus(ctx context.Context, c client.Client, w *kueue.Workload, strict bool) error
where w has the content set
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 want to be able to quickly identify which function is using Update (PUT), versus SSA (PATCH). For that reason, I find Apply
very obvious.
But we can clean this up later.
r[name] /= f | ||
} | ||
} | ||
|
||
// UpdateStatus updates the condition of a workload with ssa, | ||
// filelManager being set to managerPrefix + "-" + conditionType | ||
func UpdateStatus(ctx context.Context, |
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.
Can you rename to ApplyStatus?
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.
Let's keep "Apply" , for when we only push parts of a workload to the api server.
gomega.Eventually(func() []kueue.ReclaimablePod { | ||
gomega.Expect(k8sClient.Get(ctx, wlKey, wl)).Should(gomega.Succeed()) | ||
return wl.Status.ReclaimablePods | ||
|
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.
Reverting this empty line would be good.
Totally LGTM. |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, trasc 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 the support for dynamic resources reclaim.
Which issue(s) this PR fixes:
Fixes #78
Special notes for your reviewer:
Does this PR introduce a user-facing change?