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

Fix workload would be created and deleted indefinitely #597

Closed

Conversation

kerthcet
Copy link
Contributor

In #317, we will default workload resource requests to limits if requests not specified. But this will introduce a bug as in job controller reconciling, job will be judged as not equal to workload, so workload will be deleted and re-create indefinitely

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #590

Special notes for your reviewer:

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. labels Feb 27, 2023
@netlify
Copy link

netlify bot commented Feb 27, 2023

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 89940d5
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/6409ccb7f114f10008e91f61

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 27, 2023
@alculquicondor
Copy link
Contributor

What's missing for it to be ready for review?

@kerthcet
Copy link
Contributor Author

What's missing for it to be ready for review?

Integration tests.

@kerthcet kerthcet changed the title [WIP] Fix workload would be created and deleted indefinitely Fix workload would be created and deleted indefinitely Mar 2, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 2, 2023
@kerthcet kerthcet force-pushed the fix/job-with-limits-only branch 2 times, most recently from d8d0493 to 778c860 Compare March 2, 2023 09:19
@kerthcet
Copy link
Contributor Author

kerthcet commented Mar 2, 2023

cc @alculquicondor

// E.g. job may have resources limits configured but no requests,
// this is not allowed in workload but we can't update the job directly,
// so we need a function like this to set the defaults.
func SetContainersDefaults(containers []v1.Container) []v1.Container {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we support LimitRange later, we can also add here. If the LimitRange changes, workload will be non-equal to job.

@alculquicondor
Copy link
Contributor

/assign

// SetContainersDefaults will fill up the container defaults.
// Note that this is used to bridge the gap between job and workload,
// E.g. job may have resources limits configured but no requests,
// this is not allowed in workload but we can't update the job directly,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds confusing.

It's not that it's not allowed. The purpose of the Workload object is to represent the requests that the Pod containers will ultimately have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. One more thing, if LimitRange is introduced, workload with no requests should be rejected, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we vote against that already? #485

// so we need a function like this to set the defaults.
func SetContainersDefaults(containers []v1.Container) []v1.Container {
// This should only happen in tests.
// We didn't return nil here for spec.Containers should not be nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it also shouldn't be an empty list. I don't think returning nil makes a difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, this only happens in test, If we return nil here, integration tests will fail because it shouldn't be nil.

If we return empty slice here, unit tests will fail like

"add default podSet name": {
wl: kueue.Workload{
Spec: kueue.WorkloadSpec{
PodSets: []kueue.PodSet{
{},
},
},
},

I think I should polish the comments.

pkg/util/api/api.go Show resolved Hide resolved
pkg/util/api/api_test.go Outdated Show resolved Hide resolved
pkg/controller/workload/job/job_controller.go Outdated Show resolved Hide resolved
@@ -16,6 +16,10 @@ limitations under the License.

package api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced about putting this function here. But we can revisit once we have the jobs library completed, which will probably use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deal. Didn't find where to place this.

@alculquicondor
Copy link
Contributor

/lgtm
/approve
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Mar 3, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, kerthcet

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2023
@mimowo
Copy link
Contributor

mimowo commented Mar 3, 2023

@kerthcet would you like to follow up with an analogous fix for the MPIJob?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2023
@alculquicondor
Copy link
Contributor

Instead, can we focus on the library?

@mimowo
Copy link
Contributor

mimowo commented Mar 3, 2023

Instead, can we focus on the library?

Yes, I was just thinking it makes sense to get rid of the issue as it is now fresh in our minds, and the fix should be just a couple of lines, but I agree with the priorities.

@kerthcet
Copy link
Contributor Author

kerthcet commented Mar 9, 2023

Let me rebase this one until #616 got merged.

In kubernetes-sigs#317, we will default workload resource requests to limits
if requests not specified. But this will introduce a bug for in job controller reconciling, job will be judged
as not equal to workload, so workload will be deleted and re-create indefinitely

Signed-off-by: Kante Yin <kerthcet@gmail.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2023
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2023
@kerthcet
Copy link
Contributor Author

kerthcet commented Mar 9, 2023

Rebased.

@alculquicondor
Copy link
Contributor

@kerthcet wdyt about #600 (comment)?
I wonder if we should hold for this PR given that it would change significantly.

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2023
@k8s-ci-robot
Copy link
Contributor

@kerthcet: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-e2e-main-1-25 89940d5 link true /test pull-kueue-test-e2e-main-1-25
pull-kueue-test-e2e-main-1-26 89940d5 link true /test pull-kueue-test-e2e-main-1-26

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@kerthcet
Copy link
Contributor Author

/close

superseded by #600

@k8s-ci-robot
Copy link
Contributor

@kerthcet: Closed this PR.

In response to this:

/close

superseded by #600

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kueue deletes workloads for jobs with limits, but no requests
4 participants