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

RemoveFailedPods: guard against nil descheduler strategy (e.g. in case of default that loads all strategies) #632

Merged
merged 3 commits into from
Sep 29, 2021

Conversation

a7i
Copy link
Contributor

@a7i a7i commented Sep 20, 2021

Closes #630

Background: Descheduler by default loads all strategies and as a result, the strategy params can be nil. The strategy needs to guard against that.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 20, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @a7i. 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 20, 2021
Copy link
Contributor

@damemi damemi left a comment

Choose a reason for hiding this comment

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

The error reported came from line 44: /go/src/sigs.k8s.io/descheduler/pkg/descheduler/strategies/failedpods.go:44 +0x70

So, we also need to add a guard for the priority threshold to be non-nil https://github.com/kubernetes-sigs/descheduler/pull/632/files#diff-413def6475d16ce340793b62bb4c179595cc28669ad68d474763006464d8ee65R44

@damemi
Copy link
Contributor

damemi commented Sep 20, 2021

Also, would be good to add a test for this. It should probably be an e2e so that the whole config gets tested against (rather than just the eviction logic in a unit test)

@a7i
Copy link
Contributor Author

a7i commented Sep 20, 2021

The error reported came from line 44: /go/src/sigs.k8s.io/descheduler/pkg/descheduler/strategies/failedpods.go:44 +0x70

So, we also need to add a guard for the priority threshold to be non-nil https://github.com/kubernetes-sigs/descheduler/pull/632/files#diff-413def6475d16ce340793b62bb4c179595cc28669ad68d474763006464d8ee65R44

Hey @damemi thresholdPriority blongs to ValidatedStrategyParams so this is the actual fix:

-	*validation.ValidatedStrategyParams
+	validation.ValidatedStrategyParams

I have added a unit test which will catch the error if reverted back to reference.

@damemi
Copy link
Contributor

damemi commented Sep 20, 2021

@a7i Ah, I see. The test looks good too, thanks.
/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 20, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a7i, damemi

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 Sep 20, 2021
@damemi
Copy link
Contributor

damemi commented Sep 20, 2021

/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 Sep 20, 2021
@a7i
Copy link
Contributor Author

a7i commented Sep 20, 2021

Also, would be good to add a test for this. It should probably be an e2e so that the whole config gets tested against (rather than just the eviction logic in a unit test)

Yes, good idea. I will work on that in parallel but may take me a day or two.

@a7i
Copy link
Contributor Author

a7i commented Sep 20, 2021

/retest
Will create an issue if flaky test

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 20, 2021
@ingvagabund
Copy link
Contributor

ingvagabund commented Sep 21, 2021

Yes, good idea. I will work on that in parallel but may take me a day or two.

Let's do it in this PR as well. Unless it's critical to fix this right away.

@damemi
Copy link
Contributor

damemi commented Sep 22, 2021

@ingvagabund I would consider this critical since the strategy crashes in the default use case which causes the entire program to crash. We should merge this asap and release a patch to the v0.22 image.

@a7i will you be able to add the e2e in the next day or so? If not, we can merge this and work on the e2e

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 25, 2021
@a7i a7i requested a review from damemi September 25, 2021 14:45
@a7i
Copy link
Contributor Author

a7i commented Sep 25, 2021

@ingvagabund / @damemi Added a comprehensive set of tests for FailedPods strategy. Kept the commits separate for better organization/tracking.

Fix priority class default
@damemi
Copy link
Contributor

damemi commented Sep 28, 2021

I have no more comments, @ingvagabund do you?

@a7i could you also open a PR to the release-1.22 branch picking these commits there? Will also need to update the version in the Helm chart to v0.22.1

@a7i a7i mentioned this pull request Sep 28, 2021
@ingvagabund
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit d96dd6d into kubernetes-sigs:master Sep 29, 2021
@ingvagabund
Copy link
Contributor

@a7i thank you!!!

@a7i a7i deleted the amir/failedpods-crash branch September 29, 2021 12:49
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
RemoveFailedPods: guard against nil descheduler strategy (e.g. in case of default that loads all strategies)
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash in RemoveFailedPods strategy
4 participants