cache

package
v1.6.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 52 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBindMethod added in v1.5.0

func RegisterBindMethod(binder Binder)

RegisterBindMethod register Bind Method

Types

type BatchBinder added in v1.4.0

type BatchBinder interface {
	Bind(job *api.JobInfo, cluster string) (*api.JobInfo, error)
}

BatchBinder updates podgroup or job information

type Binder

type Binder interface {
	Bind(kubeClient *kubernetes.Clientset, tasks []*api.TaskInfo) ([]*api.TaskInfo, error)
}

Binder interface for binding task and hostname

func GetBindMethod added in v1.5.0

func GetBindMethod() Binder

type Cache

type Cache interface {
	// Run start informer
	Run(stopCh <-chan struct{})

	// Snapshot deep copy overall cache information into snapshot
	Snapshot() *api.ClusterInfo

	// WaitForCacheSync waits for all cache synced
	WaitForCacheSync(stopCh <-chan struct{})

	// AddBindTask binds Task to the target host.
	// TODO(jinzhej): clean up expire Tasks.
	AddBindTask(task *api.TaskInfo) error

	// BindPodGroup Pod/PodGroup to cluster
	BindPodGroup(job *api.JobInfo, cluster string) error

	// Evict evicts the task to release resources.
	Evict(task *api.TaskInfo, reason string) error

	// RecordJobStatusEvent records related events according to job status.
	// Deprecated: remove it after removed PDB support.
	RecordJobStatusEvent(job *api.JobInfo)

	// UpdateJobStatus puts job in backlog for a while.
	UpdateJobStatus(job *api.JobInfo, updatePG bool) (*api.JobInfo, error)

	// GetPodVolumes get pod volume on the host
	GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*scheduling.PodVolumes, error)

	// AllocateVolumes allocates volume on the host to the task
	AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *scheduling.PodVolumes) error

	// BindVolumes binds volumes to the task
	BindVolumes(task *api.TaskInfo, volumes *scheduling.PodVolumes) error

	// RevertVolumes clean cache generated by AllocateVolumes
	RevertVolumes(task *api.TaskInfo, podVolumes *scheduling.PodVolumes)

	// Client returns the kubernetes clientSet, which can be used by plugins
	Client() kubernetes.Interface

	// ClientConfig returns the rest config
	ClientConfig() *rest.Config

	UpdateSchedulerNumaInfo(sets map[string]api.ResNumaSets) error

	// SharedInformerFactory return scheduler SharedInformerFactory
	SharedInformerFactory() informers.SharedInformerFactory

	// SetMetricsConf set the metrics server related configuration
	SetMetricsConf(conf map[string]string)

	// EventRecorder returns the event recorder
	EventRecorder() record.EventRecorder
}

Cache collects pods/nodes/queues information and provides information snapshot

func New

func New(config *rest.Config, schedulerNames []string, defaultQueue string, nodeSelectors []string) Cache

New returns a Cache implementation.

type DefaultBinder added in v1.5.0

type DefaultBinder struct {
}

func NewBinder added in v1.5.0

func NewBinder() *DefaultBinder

func (*DefaultBinder) Bind added in v1.5.0

func (db *DefaultBinder) Bind(kubeClient *kubernetes.Clientset, tasks []*schedulingapi.TaskInfo) ([]*schedulingapi.TaskInfo, error)

Bind will send bind request to api server

type Evictor

type Evictor interface {
	Evict(pod *v1.Pod, reason string) error
}

Evictor interface for evict pods

type SchedulerCache

type SchedulerCache struct {
	sync.Mutex

	Binder         Binder
	Evictor        Evictor
	StatusUpdater  StatusUpdater
	PodGroupBinder BatchBinder
	VolumeBinder   VolumeBinder

	Recorder record.EventRecorder

	Jobs            map[schedulingapi.JobID]*schedulingapi.JobInfo
	Nodes           map[string]*schedulingapi.NodeInfo
	Queues          map[schedulingapi.QueueID]*schedulingapi.QueueInfo
	PriorityClasses map[string]*schedulingv1.PriorityClass
	NodeList        []string

	CSINodesStatus map[string]*schedulingapi.CSINodeStatusInfo

	NamespaceCollection map[string]*schedulingapi.NamespaceCollection

	BindFlowChannel chan *schedulingapi.TaskInfo
	// contains filtered or unexported fields
}

SchedulerCache cache for the kube batch

func (*SchedulerCache) AddBindTask added in v1.5.0

func (sc *SchedulerCache) AddBindTask(taskInfo *schedulingapi.TaskInfo) error

func (*SchedulerCache) AddJob added in v1.5.0

func (sc *SchedulerCache) AddJob(obj interface{})

AddJob add job to scheduler cache

func (*SchedulerCache) AddNode

func (sc *SchedulerCache) AddNode(obj interface{})

AddNode add node to scheduler cache

func (*SchedulerCache) AddNumaInfoV1alpha1 added in v1.4.0

func (sc *SchedulerCache) AddNumaInfoV1alpha1(obj interface{})

AddNumaInfoV1alpha1 add numa information to scheduler cache

func (*SchedulerCache) AddOrUpdateCSINode added in v1.6.1

func (sc *SchedulerCache) AddOrUpdateCSINode(obj interface{})

func (*SchedulerCache) AddPod

func (sc *SchedulerCache) AddPod(obj interface{})

AddPod add pod to scheduler cache

func (*SchedulerCache) AddPodGroupV1beta1 added in v0.4.0

func (sc *SchedulerCache) AddPodGroupV1beta1(obj interface{})

AddPodGroupV1beta1 add podgroup to scheduler cache

func (*SchedulerCache) AddPriorityClass

func (sc *SchedulerCache) AddPriorityClass(obj interface{})

AddPriorityClass add priorityclass to scheduler cache

func (*SchedulerCache) AddQueueV1beta1 added in v0.4.0

func (sc *SchedulerCache) AddQueueV1beta1(obj interface{})

AddQueueV1beta1 add queue to scheduler cache

func (*SchedulerCache) AddResourceQuota

func (sc *SchedulerCache) AddResourceQuota(obj interface{})

AddResourceQuota add ResourceQuota to scheduler cache

func (*SchedulerCache) AllocateVolumes

func (sc *SchedulerCache) AllocateVolumes(task *schedulingapi.TaskInfo, hostname string, podVolumes *volumescheduling.PodVolumes) error

AllocateVolumes allocates volume on the host to the task

func (*SchedulerCache) Bind

func (sc *SchedulerCache) Bind(tasks []*schedulingapi.TaskInfo) error

Bind binds task to the target host.

func (*SchedulerCache) BindPodGroup added in v1.4.0

func (sc *SchedulerCache) BindPodGroup(job *schedulingapi.JobInfo, cluster string) error

BindPodGroup binds job to silo cluster

func (*SchedulerCache) BindTask added in v1.5.0

func (sc *SchedulerCache) BindTask()

func (*SchedulerCache) BindVolumes

func (sc *SchedulerCache) BindVolumes(task *schedulingapi.TaskInfo, podVolumes *volumescheduling.PodVolumes) error

BindVolumes binds volumes to the task

func (*SchedulerCache) Client added in v1.0.0

func (sc *SchedulerCache) Client() kubernetes.Interface

Client returns the kubernetes clientSet

func (*SchedulerCache) ClientConfig added in v1.6.1

func (sc *SchedulerCache) ClientConfig() *rest.Config

ClientConfig returns the rest config

func (*SchedulerCache) DeleteCSINode added in v1.6.1

func (sc *SchedulerCache) DeleteCSINode(obj interface{})

func (*SchedulerCache) DeleteNode

func (sc *SchedulerCache) DeleteNode(obj interface{})

DeleteNode delete node from scheduler cache

func (*SchedulerCache) DeleteNumaInfoV1alpha1 added in v1.4.0

func (sc *SchedulerCache) DeleteNumaInfoV1alpha1(obj interface{})

DeleteNumaInfoV1alpha1 delete numa information from scheduler cache

func (*SchedulerCache) DeletePod

func (sc *SchedulerCache) DeletePod(obj interface{})

DeletePod delete pod from scheduler cache

func (*SchedulerCache) DeletePodGroupV1beta1 added in v0.4.0

func (sc *SchedulerCache) DeletePodGroupV1beta1(obj interface{})

DeletePodGroupV1beta1 delete podgroup from scheduler cache

func (*SchedulerCache) DeletePriorityClass

func (sc *SchedulerCache) DeletePriorityClass(obj interface{})

DeletePriorityClass delete priorityclass from the scheduler cache

func (*SchedulerCache) DeleteQueueV1beta1 added in v0.4.0

func (sc *SchedulerCache) DeleteQueueV1beta1(obj interface{})

DeleteQueueV1beta1 delete queue from the scheduler cache

func (*SchedulerCache) DeleteResourceQuota

func (sc *SchedulerCache) DeleteResourceQuota(obj interface{})

DeleteResourceQuota delete ResourceQuota from the scheduler cache

func (*SchedulerCache) EventRecorder added in v1.6.0

func (sc *SchedulerCache) EventRecorder() record.EventRecorder

EventRecorder returns the Event Recorder

func (*SchedulerCache) Evict

func (sc *SchedulerCache) Evict(taskInfo *schedulingapi.TaskInfo, reason string) error

Evict will evict the pod.

If error occurs both task and job are guaranteed to be in the original state.

func (*SchedulerCache) GetMetricsData added in v1.6.0

func (sc *SchedulerCache) GetMetricsData()

func (*SchedulerCache) GetPodVolumes added in v1.3.0

func (sc *SchedulerCache) GetPodVolumes(task *schedulingapi.TaskInfo, node *v1.Node) (*volumescheduling.PodVolumes, error)

GetPodVolumes get pod volume on the host

func (*SchedulerCache) RecordJobStatusEvent

func (sc *SchedulerCache) RecordJobStatusEvent(job *schedulingapi.JobInfo)

RecordJobStatusEvent records related events according to job status.

func (*SchedulerCache) RevertVolumes added in v1.6.0

func (sc *SchedulerCache) RevertVolumes(task *schedulingapi.TaskInfo, podVolumes *volumescheduling.PodVolumes)

RevertVolumes clean cache generated by AllocateVolumes

func (*SchedulerCache) Run

func (sc *SchedulerCache) Run(stopCh <-chan struct{})

Run starts the schedulerCache

func (*SchedulerCache) SetMetricsConf added in v1.6.0

func (sc *SchedulerCache) SetMetricsConf(conf map[string]string)

func (*SchedulerCache) SharedInformerFactory added in v1.4.0

func (sc *SchedulerCache) SharedInformerFactory() informers.SharedInformerFactory

SharedInformerFactory returns the scheduler SharedInformerFactory

func (*SchedulerCache) Snapshot

func (sc *SchedulerCache) Snapshot() *schedulingapi.ClusterInfo

Snapshot returns the complete snapshot of the cluster from cache

func (*SchedulerCache) String

func (sc *SchedulerCache) String() string

String returns information about the cache in a string format

func (*SchedulerCache) UpdateCSINode added in v1.6.1

func (sc *SchedulerCache) UpdateCSINode(oldObj, newObj interface{})

func (*SchedulerCache) UpdateJobStatus

func (sc *SchedulerCache) UpdateJobStatus(job *schedulingapi.JobInfo, updatePG bool) (*schedulingapi.JobInfo, error)

UpdateJobStatus update the status of job and its tasks.

func (*SchedulerCache) UpdateNode

func (sc *SchedulerCache) UpdateNode(oldObj, newObj interface{})

UpdateNode update node to scheduler cache

func (*SchedulerCache) UpdateNumaInfoV1alpha1 added in v1.4.0

func (sc *SchedulerCache) UpdateNumaInfoV1alpha1(oldObj, newObj interface{})

UpdateNumaInfoV1alpha1 update numa information to scheduler cache

func (*SchedulerCache) UpdatePod

func (sc *SchedulerCache) UpdatePod(oldObj, newObj interface{})

UpdatePod update pod to scheduler cache

func (*SchedulerCache) UpdatePodGroupV1beta1 added in v0.4.0

func (sc *SchedulerCache) UpdatePodGroupV1beta1(oldObj, newObj interface{})

UpdatePodGroupV1beta1 add podgroup to scheduler cache

func (*SchedulerCache) UpdatePriorityClass

func (sc *SchedulerCache) UpdatePriorityClass(oldObj, newObj interface{})

UpdatePriorityClass update priorityclass to scheduler cache

func (*SchedulerCache) UpdateQueueV1beta1 added in v0.4.0

func (sc *SchedulerCache) UpdateQueueV1beta1(oldObj, newObj interface{})

UpdateQueueV1beta1 update queue to scheduler cache

func (*SchedulerCache) UpdateResourceQuota

func (sc *SchedulerCache) UpdateResourceQuota(oldObj, newObj interface{})

UpdateResourceQuota update ResourceQuota to scheduler cache

func (*SchedulerCache) UpdateSchedulerNumaInfo added in v1.4.0

func (sc *SchedulerCache) UpdateSchedulerNumaInfo(AllocatedSets map[string]schedulingapi.ResNumaSets) error

UpdateSchedulerNumaInfo used to update scheduler node cache NumaSchedulerInfo

func (*SchedulerCache) WaitForCacheSync

func (sc *SchedulerCache) WaitForCacheSync(stopCh <-chan struct{})

WaitForCacheSync sync the cache with the api server

type StatusUpdater

type StatusUpdater interface {
	UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error)
	UpdatePodGroup(pg *api.PodGroup) (*api.PodGroup, error)
}

StatusUpdater updates pod with given PodCondition

type VolumeBinder

type VolumeBinder interface {
	GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*scheduling.PodVolumes, error)
	RevertVolumes(task *api.TaskInfo, podVolumes *scheduling.PodVolumes)
	AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *scheduling.PodVolumes) error
	BindVolumes(task *api.TaskInfo, podVolumes *scheduling.PodVolumes) error
}

VolumeBinder interface for allocate and bind volumes

Jump to

Keyboard shortcuts

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