-
Notifications
You must be signed in to change notification settings - Fork 293
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
Create PodTemplate before ProvisioningRequest #4086
Create PodTemplate before ProvisioningRequest #4086
Conversation
Skipping CI for Draft Pull Request. |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
f66cc05
to
3aa0a49
Compare
3aa0a49
to
0c0efc0
Compare
/cc @PBundyra |
0c0efc0
to
08ad38a
Compare
if err != nil { | ||
// it's a not found, so create it | ||
newPt := &corev1.PodTemplate{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: ptKey.Name, | ||
Namespace: ptKey.Namespace, | ||
Labels: map[string]string{ | ||
constants.ManagedByKueueLabel: "true", | ||
}, | ||
}, | ||
Template: ps.Template, | ||
} | ||
|
||
// apply the admission node selectors to the Template | ||
psi, err := podset.FromAssignment(ctx, c.client, psaMap[psName], reqPS.Count) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = podset.Merge(&newPt.Template.ObjectMeta, &newPt.Template.Spec, psi) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// copy limits to requests if needed | ||
workload.UseLimitsAsMissingRequestsInPod(&newPt.Template.Spec) |
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.
Since we moved this part to different place, can we name the function accordingly?
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 believe the function name is correct because we still need to sync controllerReference in PodTemplate. Do you have a different name in mind?
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 both functions createPodTemplate
and UseLimitsAsMissingRequestsInPod
are named ok.
I'm not sure these names are best possible, but they don't strike me as misleading.
42002bd
to
4b86d34
Compare
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 overall, but makes me wonder - what happens if the PodTemplate creation succeeds, but the ProvisioingRequest creation fails. Are we garbage collecting / deleting PodTemplates in some way?
That's a good question - I've been thinking about it too. I'm not sure how we can garbage collect it effectively. Maybe we should temporarily set ControllerReference to the Workload before we set it to ProvisionRequest? WDYT? |
sounds reasonable. if we do so they get deleted when the workload is deleted. |
Done |
051dd3b
to
2098272
Compare
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, small comments only to make it more clear why we own the PodTemplate by workload and then transfer the ownership.
@mbobrovskyi please squash the commits, I find the manual cherry-picking works better in that case |
1ebd894
to
e001823
Compare
e001823
to
cba64f4
Compare
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
/cherry-pick release-0.10 release-0.9
LGTM label has been added. Git tree hash: fea2566b7e3ad48d2a686b0556af8884834b8243
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mbobrovskyi, mimowo 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 bug
What this PR does / why we need it:
Create
PodTemplate
beforeProvisioningRequest
.Which issue(s) this PR fixes:
Fixes #3957
Special notes for your reviewer:
Does this PR introduce a user-facing change?