noderesources

package
v0.30.6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

README

Overview

This folder holds the node resources allocatable plugin implemented as discussed in NodeResourcesLeastAllocatable as score plugin.

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)

Node Resources Allocatable Plugin

Resource Weights

Resources are assigned weights based on the plugin args resources param. The base units for CPU are millicores, while the base units for memory are bytes.

Example config:

apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
leaderElection:
  leaderElect: false
clientConnection:
  kubeconfig: "REPLACE_ME_WITH_KUBE_CONFIG_PATH"
profiles:
- schedulerName: default-scheduler
  plugins:
    score:
      enabled:
      - name: NodeResourcesAllocatable
  pluginConfig:
  - name: NodeResourcesAllocatable
    args:
      mode: Least
      resources:
      - name: cpu
        weight: 1000000
      - name: memory
        weight: 1
Node Resources Least Allocatable

If plugin args specify the priority param "Least", then nodes with the least allocatable resources are scored highest.

Node Resources Most Allocatable

If plugin args specify the priority param "Most", then nodes with the most allocatable resources are scored highest.

Documentation

Index

Constants

View Source
const AllocatableName = "NodeResourcesAllocatable"

AllocatableName is the name of the plugin used in the Registry and configurations.

Variables

This section is empty.

Functions

func NewAllocatable

func NewAllocatable(_ context.Context, allocArgs runtime.Object, h framework.Handle) (framework.Plugin, error)

NewAllocatable initializes a new plugin and returns it.

Types

type Allocatable

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

Allocatable is a score plugin that favors nodes based on their allocatable resources.

func (*Allocatable) Name

func (alloc *Allocatable) Name() string

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

func (*Allocatable) NormalizeScore

func (alloc *Allocatable) NormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status

NormalizeScore invoked after scoring all nodes.

func (*Allocatable) Score

func (alloc *Allocatable) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)

Score invoked at the score extension point.

func (*Allocatable) ScoreExtensions

func (alloc *Allocatable) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions of the Score plugin.

Jump to

Keyboard shortcuts

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