Documentation ¶
Index ¶
- Constants
- func CreateRestConfig(kc string) (*rest.Config, error)
- func CreateRestConfigOrDie(kc string) *rest.Config
- func LoadBootstrapConfigMaps() ([]*v1.ConfigMap, error)
- type APIFactory
- type APIProvider
- type BindStats
- type Clients
- type HostBinding
- type KubeClient
- type KubeClientMock
- func (c *KubeClientMock) Bind(pod *v1.Pod, hostID string) error
- func (c *KubeClientMock) Create(pod *v1.Pod) (*v1.Pod, error)
- func (c *KubeClientMock) Delete(pod *v1.Pod) error
- func (c *KubeClientMock) Get(podNamespace string, podName string) (*v1.Pod, error)
- func (c *KubeClientMock) GetBindStats() BindStats
- func (c *KubeClientMock) GetClientSet() kubernetes.Interface
- func (c *KubeClientMock) GetConfigMap(namespace string, name string) (*v1.ConfigMap, error)
- func (c *KubeClientMock) GetConfigs() *rest.Config
- func (c *KubeClientMock) MockBindFn(bfn func(pod *v1.Pod, hostID string) error)
- func (c *KubeClientMock) MockCreateFn(cfn func(pod *v1.Pod) (*v1.Pod, error))
- func (c *KubeClientMock) MockDeleteFn(dfn func(pod *v1.Pod) error)
- func (c *KubeClientMock) UpdatePod(pod *v1.Pod, podMutator func(pod *v1.Pod)) (*v1.Pod, error)
- func (c *KubeClientMock) UpdateStatus(pod *v1.Pod) (*v1.Pod, error)
- type MockedAPIProvider
- func (m *MockedAPIProvider) AddConfigMap(obj *v1.ConfigMap)
- func (m *MockedAPIProvider) AddEventHandler(handlers *ResourceEventHandlers)
- func (m *MockedAPIProvider) AddNode(obj *v1.Node)
- func (m *MockedAPIProvider) AddPod(obj *v1.Pod)
- func (m *MockedAPIProvider) AddPriorityClass(obj *schedv1.PriorityClass)
- func (m *MockedAPIProvider) DeleteConfigMap(obj *v1.ConfigMap)
- func (m *MockedAPIProvider) DeleteNode(obj *v1.Node)
- func (m *MockedAPIProvider) DeletePod(obj *v1.Pod)
- func (m *MockedAPIProvider) DeletePriorityClass(obj *schedv1.PriorityClass)
- func (m *MockedAPIProvider) GetAPIs() *Clients
- func (m *MockedAPIProvider) GetNodeListerMock() *test.NodeListerMock
- func (m *MockedAPIProvider) GetPodBindStats() BindStats
- func (m *MockedAPIProvider) GetPodListerMock() *test.PodListerMock
- func (m *MockedAPIProvider) GetSchedulerAPIRegisterCount() int32
- func (m *MockedAPIProvider) GetSchedulerAPIUpdateAllocationCount() int32
- func (m *MockedAPIProvider) GetSchedulerAPIUpdateApplicationCount() int32
- func (m *MockedAPIProvider) GetSchedulerAPIUpdateNodeCount() int32
- func (m *MockedAPIProvider) IsTestingMode() bool
- func (m *MockedAPIProvider) MockBindFn(bfn func(pod *v1.Pod, hostID string) error)
- func (m *MockedAPIProvider) MockCreateFn(cfn func(pod *v1.Pod) (*v1.Pod, error))
- func (m *MockedAPIProvider) MockDeleteFn(dfn func(pod *v1.Pod) error)
- func (m *MockedAPIProvider) MockGetFn(cfn func(podName string) (*v1.Pod, error))
- func (m *MockedAPIProvider) MockSchedulerAPIUpdateAllocationFn(ufn func(request *si.AllocationRequest) error)
- func (m *MockedAPIProvider) MockSchedulerAPIUpdateApplicationFn(ufn func(request *si.ApplicationRequest) error)
- func (m *MockedAPIProvider) MockSchedulerAPIUpdateNodeFn(ufn func(request *si.NodeRequest) error)
- func (m *MockedAPIProvider) MockUpdateStatusFn(cfn func(pod *v1.Pod) (*v1.Pod, error))
- func (m *MockedAPIProvider) RunEventHandler()
- func (m *MockedAPIProvider) SetNodeLister(lister corev1.NodeLister)
- func (m *MockedAPIProvider) SetPodLister(lister corev1.PodLister)
- func (m *MockedAPIProvider) Start()
- func (m *MockedAPIProvider) Stop()
- func (m *MockedAPIProvider) UpdateConfigMap(oldObj *v1.ConfigMap, newObj *v1.ConfigMap)
- func (m *MockedAPIProvider) UpdateNode(oldObj *v1.Node, newObj *v1.Node)
- func (m *MockedAPIProvider) UpdatePod(oldObj *v1.Pod, newObj *v1.Pod)
- func (m *MockedAPIProvider) UpdatePriorityClass(oldObj *schedv1.PriorityClass, newObj *schedv1.PriorityClass)
- func (m *MockedAPIProvider) WaitForSync()
- type MockedPersistentVolumeClaimInformer
- type MockedPersistentVolumeInformer
- type MockedStorageClassInformer
- type ResourceEventHandlers
- type SchedulerKubeClient
- func (nc SchedulerKubeClient) Bind(pod *v1.Pod, hostID string) error
- func (nc SchedulerKubeClient) Create(pod *v1.Pod) (*v1.Pod, error)
- func (nc SchedulerKubeClient) Delete(pod *v1.Pod) error
- func (nc SchedulerKubeClient) Get(podNamespace string, podName string) (*v1.Pod, error)
- func (nc SchedulerKubeClient) GetClientSet() kubernetes.Interface
- func (nc SchedulerKubeClient) GetConfigMap(namespace string, name string) (*v1.ConfigMap, error)
- func (nc SchedulerKubeClient) GetConfigs() *rest.Config
- func (nc SchedulerKubeClient) UpdatePod(pod *v1.Pod, podMutator func(pod *v1.Pod)) (*v1.Pod, error)
- func (nc SchedulerKubeClient) UpdateStatus(pod *v1.Pod) (*v1.Pod, error)
- type Type
Constants ¶
const ( Add operation = iota Update Delete )
Variables ¶
This section is empty.
Functions ¶
func CreateRestConfigOrDie ¶ added in v1.2.0
func LoadBootstrapConfigMaps ¶ added in v1.2.0
Types ¶
type APIFactory ¶
type APIFactory struct {
// contains filtered or unexported fields
}
API factory maintains shared clients which can be used to access other external components e.g K8s api-server, or scheduler-core.
func NewAPIFactory ¶
func NewAPIFactory(scheduler api.SchedulerAPI, informerFactory informers.SharedInformerFactory, configs *conf.SchedulerConf, testMode bool) *APIFactory
func (*APIFactory) AddEventHandler ¶
func (s *APIFactory) AddEventHandler(handlers *ResourceEventHandlers)
func (*APIFactory) GetAPIs ¶
func (s *APIFactory) GetAPIs() *Clients
func (*APIFactory) IsTestingMode ¶
func (s *APIFactory) IsTestingMode() bool
func (*APIFactory) Start ¶
func (s *APIFactory) Start()
func (*APIFactory) Stop ¶
func (s *APIFactory) Stop()
func (*APIFactory) WaitForSync ¶
func (s *APIFactory) WaitForSync()
type APIProvider ¶
type APIProvider interface { GetAPIs() *Clients AddEventHandler(handlers *ResourceEventHandlers) Start() Stop() WaitForSync() IsTestingMode() bool }
type BindStats ¶ added in v1.3.0
type BindStats struct { First time.Time Last time.Time FirstPod *v1.Pod LastPod *v1.Pod Success int64 Errors int64 HostBindings []HostBinding }
BindStats statistics about KubeClientMock.Bind() calls
type Clients ¶
type Clients struct { // client apis KubeClient KubeClient SchedulerAPI api.SchedulerAPI // informer factory InformerFactory informers.SharedInformerFactory // resource informers PodInformer coreInformerV1.PodInformer NodeInformer coreInformerV1.NodeInformer ConfigMapInformer coreInformerV1.ConfigMapInformer PVInformer coreInformerV1.PersistentVolumeInformer PVCInformer coreInformerV1.PersistentVolumeClaimInformer StorageInformer storageInformerV1.StorageClassInformer NamespaceInformer coreInformerV1.NamespaceInformer PriorityClassInformer schedulingInformerV1.PriorityClassInformer // volume binder handles PV/PVC related operations VolumeBinder volumebinding.SchedulerVolumeBinder // contains filtered or unexported fields }
clients encapsulates a set of useful client APIs that can be shared by callers when talking to K8s api-server, or the scheduler core.
func (*Clients) GetConf ¶ added in v1.2.0
func (c *Clients) GetConf() *conf.SchedulerConf
func (*Clients) WaitForSync ¶
func (c *Clients) WaitForSync()
type HostBinding ¶ added in v1.3.0
type HostBinding struct {
// contains filtered or unexported fields
}
type KubeClient ¶
type KubeClient interface { // bind a pod to a specific host Bind(pod *v1.Pod, hostID string) error // Create a pod Create(pod *v1.Pod) (*v1.Pod, error) // Delete a pod from a host Delete(pod *v1.Pod) error // Update a pod UpdatePod(pod *v1.Pod, podMutator func(pod *v1.Pod)) (*v1.Pod, error) // Update the status of a pod UpdateStatus(pod *v1.Pod) (*v1.Pod, error) // Get a pod Get(podNamespace string, podName string) (*v1.Pod, error) // minimal expose this, only informers factory needs it GetClientSet() kubernetes.Interface GetConfigs() *rest.Config GetConfigMap(namespace string, name string) (*v1.ConfigMap, error) }
func NewBootstrapKubeClient ¶ added in v1.2.0
func NewBootstrapKubeClient(kc string) KubeClient
func NewKubeClient ¶
func NewKubeClient(kc string) KubeClient
type KubeClientMock ¶
type KubeClientMock struct {
// contains filtered or unexported fields
}
KubeClientMock allows us to inject customized bind/delete pod functions
func NewKubeClientMock ¶
func NewKubeClientMock(err bool) *KubeClientMock
func (*KubeClientMock) GetBindStats ¶ added in v1.3.0
func (c *KubeClientMock) GetBindStats() BindStats
func (*KubeClientMock) GetClientSet ¶
func (c *KubeClientMock) GetClientSet() kubernetes.Interface
func (*KubeClientMock) GetConfigMap ¶ added in v1.2.0
func (*KubeClientMock) GetConfigs ¶
func (c *KubeClientMock) GetConfigs() *rest.Config
func (*KubeClientMock) MockBindFn ¶
func (c *KubeClientMock) MockBindFn(bfn func(pod *v1.Pod, hostID string) error)
func (*KubeClientMock) MockCreateFn ¶
func (*KubeClientMock) MockDeleteFn ¶
func (c *KubeClientMock) MockDeleteFn(dfn func(pod *v1.Pod) error)
func (*KubeClientMock) UpdateStatus ¶
type MockedAPIProvider ¶
func NewMockedAPIProvider ¶
func NewMockedAPIProvider(showError bool) *MockedAPIProvider
func (*MockedAPIProvider) AddConfigMap ¶ added in v1.3.0
func (m *MockedAPIProvider) AddConfigMap(obj *v1.ConfigMap)
func (*MockedAPIProvider) AddEventHandler ¶
func (m *MockedAPIProvider) AddEventHandler(handlers *ResourceEventHandlers)
func (*MockedAPIProvider) AddNode ¶ added in v1.3.0
func (m *MockedAPIProvider) AddNode(obj *v1.Node)
func (*MockedAPIProvider) AddPod ¶ added in v1.3.0
func (m *MockedAPIProvider) AddPod(obj *v1.Pod)
func (*MockedAPIProvider) AddPriorityClass ¶ added in v1.3.0
func (m *MockedAPIProvider) AddPriorityClass(obj *schedv1.PriorityClass)
func (*MockedAPIProvider) DeleteConfigMap ¶ added in v1.3.0
func (m *MockedAPIProvider) DeleteConfigMap(obj *v1.ConfigMap)
func (*MockedAPIProvider) DeleteNode ¶ added in v1.3.0
func (m *MockedAPIProvider) DeleteNode(obj *v1.Node)
func (*MockedAPIProvider) DeletePod ¶ added in v1.3.0
func (m *MockedAPIProvider) DeletePod(obj *v1.Pod)
func (*MockedAPIProvider) DeletePriorityClass ¶ added in v1.3.0
func (m *MockedAPIProvider) DeletePriorityClass(obj *schedv1.PriorityClass)
func (*MockedAPIProvider) GetAPIs ¶
func (m *MockedAPIProvider) GetAPIs() *Clients
func (*MockedAPIProvider) GetNodeListerMock ¶ added in v1.4.0
func (m *MockedAPIProvider) GetNodeListerMock() *test.NodeListerMock
func (*MockedAPIProvider) GetPodBindStats ¶ added in v1.3.0
func (m *MockedAPIProvider) GetPodBindStats() BindStats
func (*MockedAPIProvider) GetPodListerMock ¶ added in v1.4.0
func (m *MockedAPIProvider) GetPodListerMock() *test.PodListerMock
func (*MockedAPIProvider) GetSchedulerAPIRegisterCount ¶
func (m *MockedAPIProvider) GetSchedulerAPIRegisterCount() int32
func (*MockedAPIProvider) GetSchedulerAPIUpdateAllocationCount ¶
func (m *MockedAPIProvider) GetSchedulerAPIUpdateAllocationCount() int32
func (*MockedAPIProvider) GetSchedulerAPIUpdateApplicationCount ¶
func (m *MockedAPIProvider) GetSchedulerAPIUpdateApplicationCount() int32
func (*MockedAPIProvider) GetSchedulerAPIUpdateNodeCount ¶
func (m *MockedAPIProvider) GetSchedulerAPIUpdateNodeCount() int32
func (*MockedAPIProvider) IsTestingMode ¶
func (m *MockedAPIProvider) IsTestingMode() bool
func (*MockedAPIProvider) MockBindFn ¶
func (m *MockedAPIProvider) MockBindFn(bfn func(pod *v1.Pod, hostID string) error)
func (*MockedAPIProvider) MockCreateFn ¶
func (*MockedAPIProvider) MockDeleteFn ¶
func (m *MockedAPIProvider) MockDeleteFn(dfn func(pod *v1.Pod) error)
func (*MockedAPIProvider) MockGetFn ¶
func (m *MockedAPIProvider) MockGetFn(cfn func(podName string) (*v1.Pod, error))
func (*MockedAPIProvider) MockSchedulerAPIUpdateAllocationFn ¶
func (m *MockedAPIProvider) MockSchedulerAPIUpdateAllocationFn(ufn func(request *si.AllocationRequest) error)
func (*MockedAPIProvider) MockSchedulerAPIUpdateApplicationFn ¶
func (m *MockedAPIProvider) MockSchedulerAPIUpdateApplicationFn(ufn func(request *si.ApplicationRequest) error)
func (*MockedAPIProvider) MockSchedulerAPIUpdateNodeFn ¶
func (m *MockedAPIProvider) MockSchedulerAPIUpdateNodeFn(ufn func(request *si.NodeRequest) error)
func (*MockedAPIProvider) MockUpdateStatusFn ¶
func (*MockedAPIProvider) RunEventHandler ¶ added in v1.3.0
func (m *MockedAPIProvider) RunEventHandler()
func (*MockedAPIProvider) SetNodeLister ¶
func (m *MockedAPIProvider) SetNodeLister(lister corev1.NodeLister)
func (*MockedAPIProvider) SetPodLister ¶
func (m *MockedAPIProvider) SetPodLister(lister corev1.PodLister)
func (*MockedAPIProvider) Start ¶
func (m *MockedAPIProvider) Start()
func (*MockedAPIProvider) Stop ¶
func (m *MockedAPIProvider) Stop()
func (*MockedAPIProvider) UpdateConfigMap ¶ added in v1.3.0
func (m *MockedAPIProvider) UpdateConfigMap(oldObj *v1.ConfigMap, newObj *v1.ConfigMap)
func (*MockedAPIProvider) UpdateNode ¶ added in v1.3.0
func (m *MockedAPIProvider) UpdateNode(oldObj *v1.Node, newObj *v1.Node)
func (*MockedAPIProvider) UpdatePod ¶ added in v1.3.0
func (m *MockedAPIProvider) UpdatePod(oldObj *v1.Pod, newObj *v1.Pod)
func (*MockedAPIProvider) UpdatePriorityClass ¶ added in v1.3.0
func (m *MockedAPIProvider) UpdatePriorityClass(oldObj *schedv1.PriorityClass, newObj *schedv1.PriorityClass)
func (*MockedAPIProvider) WaitForSync ¶
func (m *MockedAPIProvider) WaitForSync()
type MockedPersistentVolumeClaimInformer ¶
type MockedPersistentVolumeClaimInformer struct{}
MockedPersistentVolumeClaimInformer implements PersistentVolumeClaimInformer interface
func (*MockedPersistentVolumeClaimInformer) Informer ¶
func (m *MockedPersistentVolumeClaimInformer) Informer() cache.SharedIndexInformer
func (*MockedPersistentVolumeClaimInformer) Lister ¶
func (m *MockedPersistentVolumeClaimInformer) Lister() corev1.PersistentVolumeClaimLister
type MockedPersistentVolumeInformer ¶
type MockedPersistentVolumeInformer struct{}
MockedPersistentVolumeInformer implements PersistentVolumeInformer interface
func (*MockedPersistentVolumeInformer) Informer ¶
func (m *MockedPersistentVolumeInformer) Informer() cache.SharedIndexInformer
func (*MockedPersistentVolumeInformer) Lister ¶
func (m *MockedPersistentVolumeInformer) Lister() corev1.PersistentVolumeLister
type MockedStorageClassInformer ¶
type MockedStorageClassInformer struct{}
MockedStorageClassInformer implements StorageClassInformer interface
func (*MockedStorageClassInformer) Informer ¶
func (m *MockedStorageClassInformer) Informer() cache.SharedIndexInformer
func (*MockedStorageClassInformer) Lister ¶
func (m *MockedStorageClassInformer) Lister() storagev1.StorageClassLister
type ResourceEventHandlers ¶
type ResourceEventHandlers struct { Type FilterFn func(obj interface{}) bool AddFn func(obj interface{}) UpdateFn func(old, new interface{}) DeleteFn func(obj interface{}) }
resource handlers defines add/update/delete operations in response to the corresponding resources updates. The associated the type field points the handler functions to the correct receiver.
type SchedulerKubeClient ¶
type SchedulerKubeClient struct {
// contains filtered or unexported fields
}
func (SchedulerKubeClient) Bind ¶
func (nc SchedulerKubeClient) Bind(pod *v1.Pod, hostID string) error
func (SchedulerKubeClient) GetClientSet ¶
func (nc SchedulerKubeClient) GetClientSet() kubernetes.Interface
func (SchedulerKubeClient) GetConfigMap ¶ added in v1.2.0
func (SchedulerKubeClient) GetConfigs ¶
func (nc SchedulerKubeClient) GetConfigs() *rest.Config