Back to godoc.org

Package client

v0.0.0-...-45855b6
Latest Go to latest

The latest major version is .

Published: Aug 16, 2020 | License: Apache-2.0 | Module: github.com/HuangTing-Yao/incubator-yunikorn-k8shim

Index

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, 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() error

type APIProvider

type APIProvider interface {
	GetAPIs() *Clients
	AddEventHandler(handlers *ResourceEventHandlers)
	Start()
	Stop()
	WaitForSync() error
	IsTestingMode() bool
}

type Clients

type Clients struct {
	// configs
	Conf *conf.SchedulerConf

	// 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

	// volume binder handles PV/PVC related operations
	VolumeBinder *volumebinder.VolumeBinder
}

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) Run

func (c *Clients) Run(stopCh <-chan struct{})

func (*Clients) WaitForSync

func (c *Clients) WaitForSync(interval time.Duration, timeout time.Duration) error

type KubeClient

type KubeClient interface {
	// bind a pod to a specific host
	Bind(pod *v1.Pod, hostID string) error

	// Delete a pod from a host
	Delete(pod *v1.Pod) error

	// minimal expose this, only informers factory needs it
	GetClientSet() *kubernetes.Clientset

	GetConfigs() *rest.Config
}

func NewKubeClient

func NewKubeClient(kc string) KubeClient

type KubeClientMock

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

fake client allows us to inject customized bind/delete pod functions

func NewKubeClientMock

func NewKubeClientMock() *KubeClientMock

func (*KubeClientMock) Bind

func (c *KubeClientMock) Bind(pod *v1.Pod, hostID string) error

func (*KubeClientMock) Delete

func (c *KubeClientMock) Delete(pod *v1.Pod) error

func (*KubeClientMock) GetClientSet

func (c *KubeClientMock) GetClientSet() *kubernetes.Clientset

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) MockDeleteFn

func (c *KubeClientMock) MockDeleteFn(dfn func(pod *v1.Pod) error)

type MockedAPIProvider

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

func NewMockedAPIProvider

func NewMockedAPIProvider() *MockedAPIProvider

func (*MockedAPIProvider) AddEventHandler

func (m *MockedAPIProvider) AddEventHandler(handlers *ResourceEventHandlers)

func (*MockedAPIProvider) GetAPIs

func (m *MockedAPIProvider) GetAPIs() *Clients

func (*MockedAPIProvider) GetSchedulerApiRegisterCount

func (m *MockedAPIProvider) GetSchedulerApiRegisterCount() int32

func (*MockedAPIProvider) GetSchedulerApiUpdateCount

func (m *MockedAPIProvider) GetSchedulerApiUpdateCount() 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) MockDeleteFn

func (m *MockedAPIProvider) MockDeleteFn(dfn func(pod *v1.Pod) error)

func (*MockedAPIProvider) MockSchedulerApiUpdateFn

func (m *MockedAPIProvider) MockSchedulerApiUpdateFn(ufn func(request *si.UpdateRequest) error)

func (*MockedAPIProvider) SetNodeLister

func (m *MockedAPIProvider) SetNodeLister(lister corev1.NodeLister)

func (*MockedAPIProvider) Start

func (m *MockedAPIProvider) Start()

func (*MockedAPIProvider) Stop

func (m *MockedAPIProvider) Stop()

func (*MockedAPIProvider) WaitForSync

func (m *MockedAPIProvider) WaitForSync() error

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) Delete

func (nc SchedulerKubeClient) Delete(pod *v1.Pod) error

func (SchedulerKubeClient) GetClientSet

func (nc SchedulerKubeClient) GetClientSet() *kubernetes.Clientset

func (SchedulerKubeClient) GetConfigs

func (nc SchedulerKubeClient) GetConfigs() *rest.Config

type Type

type Type int
const (
	PodInformerHandlers Type = iota
	NodeInformerHandlers
	ConfigMapInformerHandlers
	StorageInformerHandlers
	PVInformerHandlers
	PVCInformerHandlers
)

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier