scheduler

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 9 Imported by: 0

README

Pod Scheduler Mutator

The Pod Scheduler Mutator adds the name of the StorageOS scheduler extender to the Pod's SchedulerName, if the Pod has volumes backed by StorageOS and does not have the storageos.com/scheduler=false annotation set on the Pod.

Trigger

All Pod create events are evaluated.

Pods that have the annotation storageos.com/scheduler=false set are ignored.

The Pod's volumes are enumerated, and if at least one volume is backed by StorageOS, the SchedulerName will be changed to use the StorageOS Pod scheduler.

Disabling

Pod's can be skipped individually by setting the storageos.com/scheduler=false annotation.

To disable for all Pods, the api-manager can be started with -scheduler-name set to an empty string.

Tunables

Default values work well when the api-manager is installed by the cluster-operator. They should only be changed under advisement from StorageOS support.

-scheduler-name is the name of the scheduler extender to set in the Pod's SchedulerName field. If set to an empty string, no updates will be made. When set, the scheduler name must match the name of the scheduler extender configured in the StorageOS cluster-operator. (default "storageos-scheduler").

Documentation

Overview

Package scheduler contains mutating admission controller webhook handlers for setting a pod's scheduler. The handler mutates a given pod if the pod has any volume that's managed by the given volume provisioners in PodSchedulerSetter.Provisioners and the associated scheduler is enabled. The scheduler name is set in PodSchedulerSetter.SchedulerName.

Index

Constants

View Source
const (
	// PodSchedulerAnnotationKey is the pod annotation key that can be set to
	// skip pod scheduler name mutation.
	PodSchedulerAnnotationKey = "storageos.com/scheduler"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PodSchedulerSetter

type PodSchedulerSetter struct {
	// Provisioners is a list of storage provisioners to check a pod volume
	// against.
	Provisioners []string

	// SchedulerName is the name of the scheduler to mutate pods with.
	SchedulerName string

	// SchedulerAnnotationKey is the pod annotation that can be set to skip or
	// apply the mutation.
	SchedulerAnnotationKey string

	client.Client
	// contains filtered or unexported fields
}

PodSchedulerSetter is responsible for mutating and setting pod scheduler name.

func NewPodSchedulerSetter

func NewPodSchedulerSetter(k8s client.Client, scheduler string) *PodSchedulerSetter

NewPodSchedulerSetter returns a new Pod Scheduler mutating admission controller.

func (*PodSchedulerSetter) MutatePod

func (p *PodSchedulerSetter) MutatePod(ctx context.Context, pod *corev1.Pod, namespace string) error

MutatePod mutates a given pod with a configured scheduler name if the pod is associated with volumes managed by the configured provisioners.

Errors returned here may block creation of the Pod, depending on the Webhook configuration.

Jump to

Keyboard shortcuts

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