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

Add new DefaultEvictor plugin with args #929

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

knelasevero
Copy link
Contributor

@knelasevero knelasevero commented Aug 29, 2022

Add new DefaultEvictor plugin with args, and only moving the Filter extension point to it for now.

Follow ups (other PRs):

PreEvictFilter, Sort, PreEvictSort for the default Evictor plugin

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 29, 2022
@knelasevero knelasevero marked this pull request as draft August 29, 2022 18:18
@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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 29, 2022
@knelasevero
Copy link
Contributor Author

/hold

@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 29, 2022
@knelasevero knelasevero changed the title Add new preevectionfilter plugin with args [WIP] Add new preevectionfilter plugin with args Aug 29, 2022
@knelasevero knelasevero force-pushed the ev-filter-plugin branch 3 times, most recently from ea1a3aa to 85df5f8 Compare August 31, 2022 14:21
@knelasevero knelasevero changed the title [WIP] Add new preevectionfilter plugin with args Add new preevectionfilter plugin with args Aug 31, 2022
@knelasevero knelasevero marked this pull request as ready for review August 31, 2022 14:24
@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 Aug 31, 2022
@k8s-ci-robot k8s-ci-robot requested a review from a7i August 31, 2022 14:24
@knelasevero
Copy link
Contributor Author

/unhold

@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 31, 2022
@knelasevero knelasevero changed the title Add new preevectionfilter plugin with args Add new EvectionFilter plugin with args Aug 31, 2022
@knelasevero knelasevero changed the title Add new EvectionFilter plugin with args Add new DefaultEvictor plugin with args Aug 31, 2022
@knelasevero knelasevero force-pushed the ev-filter-plugin branch 3 times, most recently from fee0975 to f199d2a Compare September 2, 2022 13:24
@knelasevero
Copy link
Contributor Author

knelasevero commented Sep 2, 2022

Had a internal discussion with Jan about naming.

This name that we have right now is a bit confusing. This plugin interface that we have right now is called EvictorPlugin, and the first default plugin is called DefaultEvictor. But this plugin is not really meant to actually evict pods, only filter/sort/etc, which will affect eviction, but is not the eviction itself. It is something like EvictorCustomizer, or EvictorBehaviour... or something...

From the user perspective, this to be called DefaultEvictor makes sense, since it feels like the user is configuring the evictor itself and how it evicts and decides to evict pods. But in code we will have one thing that is the actual evictor, and a thing that will change how the evictor filters/sorts/etc.

Just wanted to throw this here. It is confusing, but I can't think of a better name. I added comments both in defaultevictor.go and the framework types.go:

// EvictorPlugin defines extension points for a general evictor behavior
// Even though we name this plugin interface EvictorPlugin, it does not actually evict anything,
// This plugin is only meant to customize other actions (extension points) of the evictor,
// like filtering, sorting, and other ones that might be relevant in the future

I think it is sufficient, but if anybody has a better name feel free to chime in :)

There is yet another naming discussion that I will bring in the other issue #924.

type DefaultEvictorArgs struct {
metav1.TypeMeta

Nodes []*v1.Node
Copy link
Contributor

Choose a reason for hiding this comment

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

Nodes param is a tricky param. It can not be passed through the plugin arguments since a plugin is initialized before its extension point is invoked. In my PoC implementation I reached for the current nodes through the shared informer: https://github.com/kubernetes-sigs/descheduler/pull/781/files#diff-66db71b98f61a3c06ca8d17cbed99626fc23f8bab081cd71a8baf0867613d4d5R111. I am open to suggestions on how to make it better. Using the shared node informer directly is acceptable solution for the moment. Nevertheless, once the descheduler is migrated into the framework completely, we need a single method for listing ready nodes which will be invoked by this plugin and the main descheduling loop. And possibly by others who needs to have identical list of ready nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created an issue to track, and I am getting nodes from shared informers for now.

#941


const (
PluginName = "DefaultEvictor"
evictPodAnnotationKey = "descheduler.alpha.kubernetes.io/evict"
Copy link
Contributor

Choose a reason for hiding this comment

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

@damemi the annotation has been alpha for some time. I wonder whether the annotation is still in use or whether we could drop it.

Copy link
Contributor

Choose a reason for hiding this comment

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

definitely don't drop it, if anything we should probably promote it. I think this feature has shown to be useful

pkg/framework/plugins/defaultevictor/defaultevictor.go Outdated Show resolved Hide resolved
pkg/framework/plugins/defaultevictor/defaultevictor.go Outdated Show resolved Hide resolved
pkg/framework/plugins/defaultevictor/defaultevictor.go Outdated Show resolved Hide resolved
@ingvagabund
Copy link
Contributor

I think it is sufficient, but if anybody has a better name feel free to chime in :)

@knelasevero thank you for putting the comments down. Right before we introduce the v1alpha2 configuration type we will have a discussion about naming of all plugins. At that point we will need to decide which name will be the least confusing yet still sufficiently descriptive.

@knelasevero
Copy link
Contributor Author

/retest

@@ -20,7 +20,7 @@ go build -o "${OS_OUTPUT_BINPATH}/deepcopy-gen" "k8s.io/code-generator/cmd/deepc

${OS_OUTPUT_BINPATH}/deepcopy-gen \
--go-header-file "hack/boilerplate/boilerplate.go.txt" \
--input-dirs "./pkg/apis/componentconfig,./pkg/apis/componentconfig/v1alpha1,./pkg/api,./pkg/api/v1alpha1" \
--input-dirs "./pkg/apis/componentconfig,./pkg/apis/componentconfig/v1alpha1,./pkg/api,./pkg/api/v1alpha1,./pkg/framework/plugins/defaultevictor/" \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need a better way to get dirs where we have to generate code. I can work on that in another PR. For now I am adding manually

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 definitely, this is part of the reason I was okay closing #900 and holding off on these moves for now. But if you have a way to make it better, please feel free

@ingvagabund
Copy link
Contributor

/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 12, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 Sep 12, 2022
@k8s-ci-robot k8s-ci-robot merged commit 72bf50f into kubernetes-sigs:master Sep 12, 2022
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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants