cache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 37 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binder

type Binder interface {
	Bind(task *v1.Pod, hostname string) error
}

Binder interface for binding task and hostname

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{}) bool

	// Bind binds Task to the target host.
	// TODO(jinzhej): clean up expire Tasks.
	Bind(task *api.TaskInfo, hostname 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) (*api.JobInfo, error)

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

	// BindVolumes binds volumes to the task
	BindVolumes(task *api.TaskInfo) error
}

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

func New

func New(config *rest.Config, schedulerName string, defaultQueue string) Cache

New returns a Cache implementation.

type Evictor

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

Evictor interface for evict pods

type SchedulerCache

type SchedulerCache struct {
	sync.Mutex

	Binder        Binder
	Evictor       Evictor
	StatusUpdater StatusUpdater
	VolumeBinder  VolumeBinder

	Recorder record.EventRecorder

	Jobs            map[kbapi.JobID]*kbapi.JobInfo
	Nodes           map[string]*kbapi.NodeInfo
	Queues          map[kbapi.QueueID]*kbapi.QueueInfo
	PriorityClasses map[string]*v1beta1.PriorityClass
	// contains filtered or unexported fields
}

SchedulerCache cache for the kube batch

func (*SchedulerCache) AddNode

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

AddNode add node to scheduler cache

func (*SchedulerCache) AddPDB

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

AddPDB add pdb to scheduler cache

func (*SchedulerCache) AddPod

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

AddPod add pod to scheduler cache

func (*SchedulerCache) AddPodGroupAlpha1 added in v0.5.0

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

AddPodGroupAlpha1 add podgroup to scheduler cache

func (*SchedulerCache) AddPodGroupAlpha2 added in v0.5.0

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

AddPodGroupAlpha2 add podgroup to scheduler cache

func (*SchedulerCache) AddPriorityClass added in v0.4.1

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

AddPriorityClass add priorityclass to scheduler cache

func (*SchedulerCache) AddQueuev1alpha1 added in v0.5.0

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

AddQueuev1alpha1 add queue to scheduler cache

func (*SchedulerCache) AddQueuev1alpha2 added in v0.5.0

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

AddQueuev1alpha2 add queue to scheduler cache

func (*SchedulerCache) AllocateVolumes added in v0.4.1

func (sc *SchedulerCache) AllocateVolumes(task *api.TaskInfo, hostname string) error

AllocateVolumes allocates volume on the host to the task

func (*SchedulerCache) Bind

func (sc *SchedulerCache) Bind(taskInfo *kbapi.TaskInfo, hostname string) error

Bind binds task to the target host.

func (*SchedulerCache) BindVolumes added in v0.4.1

func (sc *SchedulerCache) BindVolumes(task *api.TaskInfo) error

BindVolumes binds volumes to the task

func (*SchedulerCache) DeleteNode

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

DeleteNode delete node from scheduler cache

func (*SchedulerCache) DeletePDB

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

DeletePDB delete pdb from scheduler cache

func (*SchedulerCache) DeletePod

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

DeletePod delete pod from scheduler cache

func (*SchedulerCache) DeletePodGroupAlpha1 added in v0.5.0

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

DeletePodGroupAlpha1 delete podgroup from scheduler cache

func (*SchedulerCache) DeletePodGroupAlpha2 added in v0.5.0

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

DeletePodGroupAlpha2 delete podgroup from scheduler cache

func (*SchedulerCache) DeletePriorityClass added in v0.4.1

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

DeletePriorityClass delete priorityclass from the scheduler cache

func (*SchedulerCache) DeleteQueuev1alpha1 added in v0.5.0

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

DeleteQueuev1alpha1 delete queue from the scheduler cache

func (*SchedulerCache) DeleteQueuev1alpha2 added in v0.5.0

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

DeleteQueuev1alpha2 delete queue from the scheduler cache

func (*SchedulerCache) Evict

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

Evict will evict the pod

func (*SchedulerCache) RecordJobStatusEvent added in v0.4.1

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

RecordJobStatusEvent records related events according to job status.

func (*SchedulerCache) Run

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

Run starts the schedulerCache

func (*SchedulerCache) Snapshot

func (sc *SchedulerCache) Snapshot() *kbapi.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) UpdateJobStatus added in v0.4.1

func (sc *SchedulerCache) UpdateJobStatus(job *kbapi.JobInfo) (*kbapi.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) UpdatePDB

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

UpdatePDB update pdb to scheduler cache

func (*SchedulerCache) UpdatePod

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

UpdatePod update pod to scheduler cache

func (*SchedulerCache) UpdatePodGroupAlpha1 added in v0.5.0

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

UpdatePodGroupAlpha1 add podgroup to scheduler cache

func (*SchedulerCache) UpdatePodGroupAlpha2 added in v0.5.0

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

UpdatePodGroupAlpha2 add podgroup to scheduler cache

func (*SchedulerCache) UpdatePriorityClass added in v0.4.1

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

UpdatePriorityClass update priorityclass to scheduler cache

func (*SchedulerCache) UpdateQueuev1alpha1 added in v0.5.0

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

UpdateQueuev1alpha1 update queue to scheduler cache

func (*SchedulerCache) UpdateQueuev1alpha2 added in v0.5.0

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

UpdateQueuev1alpha2 update queue to scheduler cache

func (*SchedulerCache) WaitForCacheSync

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

WaitForCacheSync sync the cache with the api server

type StatusUpdater added in v0.4.1

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 added in v0.4.1

type VolumeBinder interface {
	AllocateVolumes(task *api.TaskInfo, hostname string) error
	BindVolumes(task *api.TaskInfo) 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