crossnodepreemption

package
v0.20.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

Overview

The PostFilter extension point was introduced in Kubernetes Scheduler since 1.19, and the default implementation in upstream is to preempt Pods on the same node to make room for the unschedulable Pod.

In contrast to the "same-node-preemption" strategy, we can come up with a "cross-node-preemption" strategy to preempt Pods across multiple nodes, which is useful when a Pod cannot be scheduled due to "cross node" constraints such as PodTopologySpread and PodAntiAffinity. This was also mentioned in the original design document of Preemption.

This plugin is built as a sample to demonstrate how to use PostFilter extension point, as well as inspiring users to built their own innovative strategies, such as preepmpting a group of Pods.

⚠️ CAVEAT: Current implementation doesn't do any branch cutting, but uses a DFS algorithm to iterate all possible preemption strategies. DO NOT use it in your production env.

Maturity Level

  • 💡 Sample (for demonstrating and inspiring purpose)
  • 👶 Alpha (used in companies for pilot projects)
  • 👦 Beta (used in companies and developed actively)
  • 👨 Stable (used in companies for production workloads)

Example config:

apiVersion: kubescheduler.config.k8s.io/v1beta1
kind: KubeSchedulerConfiguration
leaderElection:
  leaderElect: false
clientConnection:
  kubeconfig: "REPLACE_ME_WITH_KUBE_CONFIG_PATH"
profiles:
- schedulerName: default-scheduler
  plugins:
    postFilter:
      enabled:
      - name: CrossNodePreemption

Documentation

Index

Constants

View Source
const (
	// Name of the plugin used in the plugin registry and configurations.
	Name = "CrossNodePreemption"
)

Variables

This section is empty.

Functions

func FindCandidates

FindCandidates calculates a slice of preemption candidates. Each candidate is executable to make the given <pod> schedulable.

func New

New initializes a new plugin and returns it.

Types

type CrossNodePreemption

type CrossNodePreemption struct {
	// contains filtered or unexported fields
}

CrossNodePreemption is a PostFilter plugin implements the preemption logic.

func (*CrossNodePreemption) Name

func (pl *CrossNodePreemption) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*CrossNodePreemption) PostFilter

PostFilter invoked at the postFilter extension point.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL