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

Redefine IsEvictable to be customizable for a particular strategy #372

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

ingvagabund
Copy link
Contributor

Use WithXXX methods to extend the list of constraints to also
provide a reasonable error message.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 13, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 13, 2020
pkg/descheduler/evictions/evictions.go Outdated Show resolved Hide resolved
pkg/descheduler/evictions/evictions.go Show resolved Hide resolved
pkg/descheduler/evictions/evictions.go Outdated Show resolved Hide resolved
pkg/descheduler/evictions/evictions.go Outdated Show resolved Hide resolved
pkg/descheduler/evictions/evictions.go Show resolved Hide resolved
pkg/descheduler/strategies/duplicates.go Outdated Show resolved Hide resolved
pkg/descheduler/evictions/evictions.go Show resolved Hide resolved
@@ -187,6 +152,66 @@ func evictPod(ctx context.Context, client clientset.Interface, pod *v1.Pod, poli
return err
}

type constraint func(pod *v1.Pod) error

type evictable struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems odd that this is a private type but all the functions that work with it are public. Might be better as a public type, and then if we add more options to it in the future, it could be declared as a literal

I'm not sure on the name, I think something like EvictOptions might be clearer. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was the idea. Keep the actual implementation hidden and just rely on a single IsEvictable invocation. I have created Options struct instead of having WithPriorityThreshold as a method.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 18, 2020
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.

one nit on a comment but the rest looks good at this point
/approve
/hold

feel free to remove the hold whenever you're ready

pkg/descheduler/evictions/evictions.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 18, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Aug 18, 2020
Use WithXXX methods to extend the list of constraints to also
provide a reasonable error message.
@ingvagabund
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 19, 2020
Copy link
Contributor

@lixiang233 lixiang233 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2020
@k8s-ci-robot k8s-ci-robot merged commit 6ccd80f into kubernetes-sigs:master Aug 19, 2020
@ingvagabund ingvagabund deleted the isevictable branch August 19, 2020 11:11
@seanmalloy
Copy link
Member

/kind cleanup

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 20, 2020
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
Redefine IsEvictable to be customizable for a particular strategy
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

5 participants