descheduler icon indicating copy to clipboard operation
descheduler copied to clipboard

Extend descheduler to support out-of-tree strategies

Open Garrybest opened this issue 3 years ago • 11 comments

Is your feature request related to a problem? Please describe.

Now descheduler only supports the built-in strategies. If someone has their own strategies, they must fork this repo and modify the source code. It is not really elegant because when descheduler has been upgraded, they must rebase their codes and maybe fix some conflicts.

Describe the solution you'd like

I wanna add a registry factory in descheduler. Users only need to:

  1. Depend this repo in their own project.
  2. Implement the strategy interface of their own strategy as a plugin factory to tell descheduler to add the strategies.
  3. Register the plugins as a parameter by calling NewDeschedulerCommand.

The inspiration is from kube-scheduler out-of-tree plugin registry. The project scheduler-plugin is based on this cool function. It adds new scheduler plugins without modifying any source codes in kube-scheduler.

Describe alternatives you've considered

What version of descheduler are you using?

descheduler version:

Additional context

Garrybest avatar Dec 15 '21 03:12 Garrybest

cc @damemi @ingvagabund

Garrybest avatar Dec 15 '21 03:12 Garrybest

I think we've mentioned this idea before, but haven't formalized it. I like the idea of a descheduler framework modeled after the scheduler framework. And, most of the concepts are already established. I think along with a couple other ideas like https://github.com/kubernetes-sigs/descheduler/issues/646 https://github.com/kubernetes-sigs/descheduler/issues/586 and https://github.com/kubernetes-sigs/descheduler/issues/486 this could be a good time to start reviving the v1alpha2 proposal

damemi avatar Dec 15 '21 14:12 damemi

Hey @damemi, just read the v1alpha2 proposal. Just wanted to propose a custom resource for the Strategy to implement custom strategies as mentioned in #686.

What I'm looking for is something like DeschedulerStrategy:

apiVersion: "descheduler/v1alpha2"
kind: "DeschedulerStrategy"
name: "MyCustomStrategy"
...

# just for an example, roughly written
podFilter:
 filter: "FilterType"
 with_namespaces:
  - foo
 without_namespaces:
  - bar
 label_selector: "baz"

strategy:
 for_each: "node"
 pods: "ListPodsOnANode"
 when:
  ...
 action:
  ...

So we can use the strategy in the DeschedulerPolicy:

apiVersion: "descheduler/v1alpha2"
kind: "DeschedulerPolicy"
profiles:
- name: "my-custom-policy"
  strategies:
    "MyCustomStrategy"
     ...
...

Thoughts? 🤔

Dentrax avatar Jan 07 '22 14:01 Dentrax

@Dentrax definitely a cool idea. Could you elaborate more on how you think a custom resource could be used? I worry the logic that could be expressed through a CRD for a custom strategy would be limited vs code

Comparing to the scheduler framework, that doesn't need additional CRDs for users to implement custom plugins. It's more hinged on the Plugin type being defined as an implementable interface.

damemi avatar Jan 07 '22 14:01 damemi

Thanks!

I worry the logic that could be expressed through a CRD for a custom strategy would be limited vs code

Strongly agree here. It obvious that we could not achieve that extensibility by writing CRDs instead of code.

According to Kubernetes's extensible mental model, it would be great to make that strategies "extensible". I'm not so sure how we can achieve this in simple and minimal manner but CRD is one of the first things that i thought.

Maybe creating something like "Custom StrategyWebhook" could fit in pluggible system. It directly calls webhook using HTTP with predefined API spec, and tells to descheduler what to do if given condition is matched, for example.

Waiting your proposals & ideas!

Dentrax avatar Jan 07 '22 15:01 Dentrax

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 07 '22 15:04 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar May 07 '22 15:05 k8s-triage-robot

/remove-lifecycle rotten see https://github.com/kubernetes-sigs/descheduler/issues/753#issuecomment-1116043835

damemi avatar May 09 '22 11:05 damemi

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 07 '22 12:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Sep 06 '22 12:09 k8s-triage-robot

/remove-lifecycle rotten /lifecycle frozen

damemi avatar Sep 06 '22 13:09 damemi