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

Doc: design doc for pdb plugin #2990

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/design/images/pdb-workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/design/pdb-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Pod Disruption Budget (PDB) Plugin

## Introduction

When users apply jobs to volcano, they may limit the number of Pod copies that are destroyed at the same time. This restriction is often limited by the [PDB resources](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) created by the user. So PDB plugin is provided to meet the PBD constraints set by the user during the Volcano scheduling process.

## Usage
1. Firstly, please ensure that your k8s version is at least 1.21 and that you have created the PDB resource.
2. Secondly, user can open `PDB Plugin` via `volcano-scheduler-configmap` in following format:

```yaml
actions: "reclaim, preempt, shuffle"
tiers:
- plugins:
- name: pdb
```
*PDB Plugin can be used in any one action of reclaim, preempt, shuffle*

## Solution
The plugin register , `ReclaimableFn`, `PreemptableFn` and `VictimTasksFn` in `Reclaim`, `Preempt` and `Shuffle` action to filter out tasks that violate the PDB constraint.

The execution flow chart of filter process of `pdb` plugin is shown as below:

![workflow](./images/pdb-workflow.png)

*`DisruptedPods` contains information about pods whose eviction was processed by the API server eviction subresource handler but has not yet been observed by the PodDisruptionBudget controller.*

### About the Cache
The PDB plugin first registers `informerFactory.Policy().V1().PodDisruptionBudgets()` in `newSchedulerCache()` function.

Then the plugin adds `v1.PodDisruptionBudgetLister` variable to type definition and inits it with `informerFactory.Policy().V1().PodDisruptionBudgets().Lister()` in `New()` function.

Finally the plugin uses this `Lister` to list the PDBs from the informer cache.
## Feature Interaction

1. By now we only need 1 argument `sla-waiting-time`, so I add it into annotations for simplicity and invocation, but when `sla` plugin is extended with more arguments, a better way to invoke this plugin may be job plugin like `svc` and `ssh`.