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

Swap admitted condition in the same API call as admission or eviction #654

Merged

Conversation

mcariatm
Copy link
Contributor

@mcariatm mcariatm commented Mar 20, 2023

What type of PR is this?

To reduce complexity in the Workload controller and reduce API usage.

What this PR does / why we need it:

Set the Admitted condition value in the same API call that sets .status.admission.

Which issue(s) this PR fixes:

Fixes #603

Special notes for your reviewer:

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Mar 20, 2023

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit c0ccdb4
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/642c56060980440008516735

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 20, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @mcariatm. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 20, 2023
@alculquicondor
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 20, 2023
@mcariatm
Copy link
Contributor Author

/ok-to-test

I'm still updating integration tests.

pkg/controller/core/workload_controller.go Outdated Show resolved Hide resolved
pkg/controller/core/workload_controller.go Outdated Show resolved Hide resolved
Message: fmt.Sprintf("Preempted by ClusterQueue %s", target.Obj.Status.Admission.ClusterQueue),
}
}
err := p.applyPreemption(ctx, workload.AdmissionPatch(target.Obj))
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is the beauty of SSA:
You don't need to find the old condition. You can just send a patch that includes the condition and the server would find the old one and replace it.

@alculquicondor
Copy link
Contributor

alculquicondor commented Mar 20, 2023

I like what you are doing: keeping the admission field and changing the controller to just use the condition.

This is going to help towards issues like this one #510, where after eviction we need to know what the assigned flavors were.

Naturally, a lot of tests will need to change to check for the condition instead of empty admission field. I think you can use ExpectWorkloadsToBePending

func ExpectWorkloadsToBePending(ctx context.Context, k8sClient client.Client, wls ...*kueue.Workload) {

@mcariatm mcariatm force-pushed the 603_admitted_condition_swap_complexity branch 2 times, most recently from e8df75d to e4adb5f Compare March 21, 2023 14:36
@alculquicondor
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added 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. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 22, 2023
@mcariatm
Copy link
Contributor Author

/easycla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 22, 2023
@mcariatm
Copy link
Contributor Author

/retest

@alculquicondor
Copy link
Contributor

/milestone v0.3

@alculquicondor alculquicondor added this to the v0.3 milestone Mar 23, 2023
@alculquicondor alculquicondor mentioned this pull request Mar 23, 2023
20 tasks
@kerthcet
Copy link
Contributor

Hi, any progress? New release is blocking on this.

@mcariatm
Copy link
Contributor Author

I'm still struggling with this error when I run the tests.
2023-03-28T12:30:00.004214789+03:00 ERROR controller/controller.go:329 Reconciler error {"controller": "workload", "controllerGroup": "kueue.x-k8s.io", "controllerKind": "Workload", "Workload": {"name":"prod1","namespace":"podsready-mgfbp"}, "namespace": "podsready-mgfbp", "name": "prod1", "reconcileID": "c487bb3d-e222-45e9-a9dc-25fb00735e6f", "error": "Workload.kueue.x-k8s.io \"prod1\" is invalid: status: Invalid value: \"null\": status in body must be of type object: \"null\""} sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler /home/mcaria/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:329 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem /home/mcaria/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:274 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2 /home/mcaria/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:235 2023-03-28T12:30:00.009476515+03:00 LEVEL(-2) core/workload_controller.go:142 Reconciling Workload {"controller": "workload", "controllerGroup": "kueue.x-k8s.io", "controllerKind": "Workload", "Workload": {"name":"prod1","namespace":"podsready-mgfbp"}, "namespace": "podsready-mgfbp", "name": "prod1", "reconcileID": "2f12b924-c203-4547-89ea-26f9ba61cb67", "workload": {"name":"prod1","namespace":"podsready-mgfbp"}}

@mcariatm mcariatm force-pushed the 603_admitted_condition_swap_complexity branch from 1a3e16d to f4bc8e1 Compare April 3, 2023 07:53
@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 3, 2023

/retest

1 similar comment
@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 3, 2023

/retest

@mcariatm mcariatm force-pushed the 603_admitted_condition_swap_complexity branch from 0bb02b0 to 3622045 Compare April 4, 2023 10:58
@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

/test pull-kueue-test-integration-main

1 similar comment
@trasc
Copy link
Contributor

trasc commented Apr 4, 2023

/test pull-kueue-test-integration-main

@alculquicondor
Copy link
Contributor

when rerunning the test suite, please indicate how many times it has passed already

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 2/3
/test pull-kueue-test-integration-main

pkg/cache/cache.go Show resolved Hide resolved
pkg/scheduler/scheduler.go Outdated Show resolved Hide resolved
@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 3/10
/test pull-kueue-test-integration-main

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 4/10
/test pull-kueue-test-integration-main

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 5/10
/test pull-kueue-test-integration-main

@alculquicondor
Copy link
Contributor

Passed 6/10
/test pull-kueue-test-integration-main

@alculquicondor
Copy link
Contributor

Passed 7/10
/test pull-kueue-test-integration-main

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 8/10
/test pull-kueue-test-integration-main

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 9/10
/test pull-kueue-test-integration-main

@mcariatm
Copy link
Contributor Author

mcariatm commented Apr 4, 2023

Passed 10/10

Copy link
Contributor

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

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

pkg/cache/cache_test.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 4, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Apr 4, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5227f60 into kubernetes-sigs:main Apr 4, 2023
@alculquicondor
Copy link
Contributor

/retitle Swap admitted condition in the same API call as admission or eviction

@k8s-ci-robot k8s-ci-robot changed the title 603 admitted condition swap complexity Swap admitted condition in the same API call as admission or eviction Apr 4, 2023
@trasc trasc deleted the 603_admitted_condition_swap_complexity branch October 24, 2023 06:40
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Swap Admitted condition value when setting .status.admission
5 participants